Tailwind CSS Cheatsheet
Tailwind CSS Cheatsheet
Tailwind CSS Cheatsheet
Hover States
.hover-bg {
@apply hover:bg-gray-200 p-4;
}
Hover Animation
.transform\:hover\:scale-110:hover {
transform: scale(1.1);
}
Responsive Design
.responsive {
@apply lg:w-1/2 xl:w-1/3;
}
Text Size
.text-xl {
font-size: 1.25rem;
}
Font Style
.italic {
font-style: italic;
}
Text Color
.text-green-500 {
color: #13ce66;
}
Font Weight
.font-extrabold {
font-weight: 800;
}
Flex Alignment
.flex:items-center {
align-items: center;
}.justify-between {
justify-content: space-between;
}
Dark Mode
.dark-mode {
@apply dark:bg-gray-800 dark:text-white p-4;
}
Custom Patterns
.custom-pattern {
@apply pattern-checkers-sm;
}
Theme Customization
.custom-theme {
@apply bg-primary text-secondary;
}
Arbitrary Values
.arbitrary-values {
@apply p-10 m-[20px];
}
Arbitrary Properties
.arbitrary-properties {
@apply rotate-45 translate-x-8;
}
Base Values
.base-values {
@apply container mx-auto;
}
@apply
.my-button {
@apply bg-blue-500 text-white font-bold py-2 px-4 rounded;
}
Flexbox
.flex-example {
@apply flex items-center justify-center h-16 bg-gray-200;
}
Grid Layout
.grid-layout {
@apply grid grid-cols-3 gap-4;
}
Typography
.bold-text {
@apply text-2xl font-bold text-blue-600;
}
Background Color
.bg-gray-300 {
background-color: #d3dce6;
}
.m-4 {
margin: 1rem;
}
Border
.border-2 {
border-width: 2px;
}
.border-blue-500 {
border-color: #1fb6ff;
}
Rounded Corners
.rounded-lg {
border-radius: 0.5rem;
}
Grid Container
.grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.h-32 {
height: 8rem;
}
Visibility
.invisible {
visibility: hidden;
}
Opacity
.opacity-75 {
opacity: 0.75;
}
Spacing
.space-x-4 {
margin-right: 1rem;
margin-left: 1rem;
}
Z-Index
.z-10 {
z-index: 10;
}
Positioning
.absolute {
position: absolute;
bottom: 0;
right: 0;
}
Shadow
.shadow-md {
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0,
0, 0, 0.06);
}
Container Width
.container {
width: 100%;
margin-right: 50%;
margin-left: 50%;
}
Placeholder Color
::placeholder {
color: #1b6ddf;
}
Breakpoint Visibility
.lg:hidden@lg {
display: none;
}
List Styling
.list-disc {
list-style-type: disc;
}
Table Styling
.table-auto {
width: 50%;
table-layout: auto;
}
.border {
border-width: 1px;
}
Gradient Background
.bg-gradient-to-r {
background: linear-gradient(to right, #1fb6ff, #13ce66);
}
Aspect Ratio
.aspect-w-16 {
width: 4rem;
}
.aspect-h-9 {
height: 2.25rem;
}