What is Tailwind CSS?
Tailwind CSS is a utility-first CSS framework that provides predefined low-level classes (like flex, p-4, text-center, bg-blue-500) to build custom designs directly in HTML without writing much custom CSS, allowing faster development and high customization.
How is Tailwind different from Bootstrap?
Tip: Use Bootstrap for quick ready UI, Tailwind for fully custom designs.
Why is Tailwind called a utility-first framework?
Tailwind is called a utility-first framework because it provides small single-purpose utility classes (like margin, padding, flex, text-center, bg-blue-500) that are combined directly in HTML to build designs, instead of writing custom CSS or using prebuilt components.
Advantages of Tailwind CSS
Tip: Tailwind improves speed and flexibility while keeping styling consistent.
Disadvantages of Tailwind CSS
Tip: Tailwind is powerful for customization but can reduce HTML readability if not structured properly.
How Tailwind improves development speed?
Tip: Tailwind speeds development by letting developers build UI directly without writing separate CSS.
What is utility-first CSS?
Utility-first CSS is an approach where small single-purpose classes (like spacing, color, flex, alignment) are used directly in HTML to style elements, instead of writing custom CSS or creating large component styles, allowing faster and more flexible UI development.
How Tailwind handles responsiveness?
sm:, md:, lg:, xl:.Tip: Tailwind makes responsiveness simple by adding breakpoint prefixes directly to utility classes.
What are breakpoints in Tailwind?
sm (small), md (medium), lg (large), xl (extra large), 2xl (very large screens).md:text-lg, lg:flex.Tip: Breakpoints help adjust layout and styling automatically for different screen sizes.
Mobile-first approach in Tailwind
sm:, md:, lg:, xl: for bigger screens.Tip: Start styling for mobile, then enhance design step-by-step for larger screens.
How to center a div in Tailwind?
flex with justify-center and items-center to center horizontally and vertically.class="flex justify-center items-center h-screen".mx-auto.grid place-items-center.Tip: flex + justify-center + items-center is the most common way to perfectly center a div.
What is flex, grid in Tailwind?
flex enables Flexbox layout for one-dimensional alignment (row or column).justify-center, items-center, flex-col.grid enables CSS Grid layout for two-dimensional control (rows and columns).grid-cols-3, gap-4, place-items-center.Tip: Use flex for alignment and small layouts, grid for full page or complex layouts.
Difference between flex and inline-flex
flex makes the element a block-level flex container and takes full available width.inline-flex makes the element an inline-level flex container and takes only required content width.flex starts on a new line, while inline-flex stays inline with other elements.Tip: Use flex for layout sections and inline-flex for small inline components like buttons or badges.
How to handle spacing in Tailwind?
Margin vs padding utilities
What is container class?
How to customize Tailwind config?
What is tailwind.config.js?
How to add custom colors?
How to add custom fonts?