1. What is Tailwind CSS primarily known for?
- Component-based design
- Utility-first approach
- Inline styling
- Preprocessor functions
Correct Answer: Utility-first approach
Get the Preplance app for a seamless learning experience. Practice offline, get daily streaks, and stay ahead with real-time interview updates.
Get it on
Google Play
4.9/5 Rating on Store
Tailwind CSS · Complete Question Bank
Practice the complete collection of Tailwind CSS interview questions including theory, coding, MCQs and real interview problems.
Questions
164
Full database
Topics
16
Categorised
Difficulty
Mixed Levels
Easy Hard
Scroll through every important Tailwind CSS question asked in real interviews. Includes MCQs, subjective questions, and coding prompts.
Correct Answer: Utility-first approach
Browse more Tailwind CSS questions, explore related subjects, or practice full interview sets to strengthen your preparation.
Correct Answer: npm install tailwindcss
npm install tailwindcss npx tailwindcss init
Correct Answer: A class that applies one specific style rule
class='text-center text-blue-500 font-bold'
Correct Answer: Faster development with reusable classes
Correct Answer: In your CSS file using @tailwind directives
@tailwind base; @tailwind components; @tailwind utilities;
Correct Answer: Yes, by extending in the config or adding stylesheets
Correct Answer: Generate styles on demand
Correct Answer: To configure your Tailwind project
npx tailwindcss init
Correct Answer: Extend adds new values, theme replaces defaults
theme: { extend: { colors: { brand: '#1E40AF' } } }Correct Answer: To tell Tailwind where to look for class names
content: ['./src/**/*.{html,js,jsx,ts,tsx}']Correct Answer: Using the extend property in config
theme: { extend: { colors: { brand: '#0EA5E9' } } }Correct Answer: Inside theme.fontFamily
theme: { extend: { fontFamily: { sans: ['Inter', 'sans-serif'] } } }Correct Answer: Add them to theme.spacing
theme: { extend: { spacing: { '18': '4.5rem' } } }Correct Answer: To add new CSS features
plugins: [require('@tailwindcss/typography')]Correct Answer: flex
class='flex items-center justify-between'
Correct Answer: flex-col
class='flex flex-col gap-4'
Correct Answer: justify-center
class='flex justify-center'
Correct Answer: items-center
class='flex items-center justify-center h-screen'
Correct Answer: Adds spacing between flex or grid items
class='flex gap-4'
Correct Answer: grid
class='grid grid-cols-3 gap-6'
Correct Answer: Three equal columns
class='grid grid-cols-3 gap-4'
Correct Answer: Centers content and sets max-width at breakpoints
class='container mx-auto px-4'
Correct Answer: absolute
class='relative'><div class='absolute top-0 left-0'>
Correct Answer: flex-wrap
class='flex flex-wrap gap-2'
Correct Answer: Creates column flow in grid items
class='grid grid-flow-col gap-4'
Correct Answer: text-lg
class='text-lg font-semibold'
Correct Answer: font-bold
class='font-bold text-gray-800'
Correct Answer: Sets text color to medium blue
class='text-blue-500 hover:text-blue-700'
Correct Answer: bg-red-500
class='bg-red-500 text-white'
Correct Answer: text-center
class='text-center text-gray-700'
Correct Answer: leading-
class='text-lg leading-relaxed'
Correct Answer: Letter spacing
class='tracking-wide uppercase'
Correct Answer: Padding 1rem
class='p-4 m-2'
Correct Answer: mx-auto
class='w-1/2 mx-auto'
Correct Answer: Sans-serif fonts
class='font-sans text-gray-800'
Correct Answer: uppercase
class='uppercase tracking-widest'
Correct Answer: Smooths font rendering
class='antialiased text-gray-900'
Correct Answer: bg-blue-500
class='bg-blue-500 text-white'
Correct Answer: bg-gradient-to-r
class='bg-gradient-to-r from-blue-400 to-green-500'
Correct Answer: Creates a vertical gradient top to bottom
class='bg-gradient-to-b from-purple-400 to-indigo-700'
Correct Answer: bg-no-repeat
class='bg-no-repeat bg-cover bg-center'
Correct Answer: Changes border color to red
class='border border-red-500 rounded-lg'
Correct Answer: border-2
class='border-2 border-gray-400'
Correct Answer: Makes an element fully circular
class='w-16 h-16 rounded-full bg-blue-500'
Correct Answer: shadow-md
class='bg-white p-6 shadow-md rounded-lg'
Correct Answer: rounded-sm
class='rounded-sm border border-gray-300'
Correct Answer: Focus outlines and emphasis rings
class='focus:ring-2 focus:ring-blue-500'
Correct Answer: bg-blend-multiply
class='bg-blend-multiply bg-blue-500 bg-[url(bg.jpg)]'
Correct Answer: Mobile-first
class='text-sm md:text-lg lg:text-xl'
Correct Answer: Minimum width 768px
class='bg-blue-300 md:bg-green-300'
Correct Answer: 1024px
class='text-base lg:text-xl'
Correct Answer: sm:p-2 lg:p-6
class='p-1 sm:p-2 lg:p-6'
Correct Answer: container
class='container mx-auto px-4'
Correct Answer: sm:hidden lg:block
class='sm:hidden lg:block'
Correct Answer: Set darkMode: 'media' in tailwind.config.js
module.exports = { darkMode: 'class' }Correct Answer: Applies styles only in dark mode
class='bg-white dark:bg-gray-900'
Correct Answer: System color scheme media query
Correct Answer: bg-cover
class='bg-cover bg-center'
Correct Answer: Applies styles on hover state
class='bg-blue-500 hover:bg-blue-700'
Correct Answer: When the element is focused via keyboard or click
class='focus:outline-none focus:ring-2 focus:ring-blue-500'
Correct Answer: active:
class='bg-blue-600 active:bg-blue-800'
Correct Answer: disabled:
class='bg-blue-500 disabled:bg-gray-400 disabled:cursor-not-allowed'
Correct Answer: Targets nested elements when parent is hovered
<div class='group hover:bg-gray-100'><p class='group-hover:text-blue-500'>Hover me</p></div>
Correct Answer: Allows sibling elements to respond to another’s state
<input type='checkbox' class='peer'><p class='peer-checked:block hidden'>Visible on check</p>
Correct Answer: Only when focused via keyboard navigation
class='focus-visible:ring-2 focus-visible:ring-indigo-500'
Correct Answer: placeholder:
class='placeholder-gray-400 focus:placeholder-gray-600'
Correct Answer: odd: even:
class='odd:bg-gray-100 even:bg-white'
Correct Answer: first: and last:
class='first:rounded-t last:rounded-b'
Correct Answer: Enables smooth property changes
class='transition duration-300 hover:bg-blue-600'
Correct Answer: Transition lasts 500 milliseconds
class='transition duration-500 ease-in-out'
Correct Answer: delay-300
class='transition delay-300 hover:opacity-80'
Correct Answer: ease-in
class='transition ease-in duration-300'
Correct Answer: Increases size by 10%
class='transform hover:scale-110'
Correct Answer: Adds rotation of 45 degrees
class='transform hover:rotate-45'
Correct Answer: Moves element 1rem right
class='transform hover:translate-x-4'
Correct Answer: animate-spin
class='animate-spin h-6 w-6 text-blue-500'
Correct Answer: Expands and fades element like a ripple
class='animate-ping absolute h-4 w-4 bg-blue-400 rounded-full'
Correct Answer: animate-pulse
class='animate-pulse bg-gray-200 h-6 w-32'
Correct Answer: bg-blue-500 text-white rounded
class='bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600'
Correct Answer: shadow-lg rounded-lg p-4 bg-white
class='bg-white rounded-lg shadow-lg p-4'
Correct Answer: w-full h-full fixed inset-0
class='fixed inset-0 w-full h-full bg-black/50 flex items-center justify-center'
Correct Answer: flex justify-between items-center
class='flex justify-between items-center px-6 py-4 bg-gray-800 text-white'
Correct Answer: rounded-full object-cover
class='w-20 h-20 rounded-full object-cover'
Correct Answer: grid grid-cols-3 gap-4
class='grid grid-cols-3 gap-4'
Correct Answer: inline-block px-2 py-1 text-xs rounded-full bg-green-100 text-green-800
class='inline-block px-2 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800'
Correct Answer: flex flex-col md:flex-row
class='flex flex-col md:flex-row gap-4'
Correct Answer: flex items-center justify-center
class='flex items-center justify-center h-screen'
Correct Answer: shadow-xl
class='bg-white rounded-lg shadow-xl p-6'
Correct Answer: npm install tailwindcss postcss autoprefixer
npm install tailwindcss postcss autoprefixer
Correct Answer: In app.js or layout.js file
import '../styles/globals.css';
Correct Answer: Through content scanning and tree-shaking
content: ['./src/**/*.{js,jsx,ts,tsx,html}']Correct Answer: To generate styles on demand
npx tailwindcss -i ./src/input.css -o ./dist/output.css --watch
Correct Answer: Yes, by using @apply with styled-components
Correct Answer: Extract them into reusable class patterns using @apply
@layer components { .btn { @apply px-4 py-2 bg-blue-500 text-white rounded; } }Correct Answer: By extending the theme configuration
theme: { extend: { colors: { brand: '#2563EB' } } }Correct Answer: PostCSS with purge and minify steps
Correct Answer: Add responsive width and height utilities
class='w-full sm:w-1/2 rounded-lg'
Correct Answer: .form-control
<input type='text' class='form-control' placeholder='Your name'>
Correct Answer: .form-select
<select class='form-select'><option>One</option></select>
Correct Answer: .form-check
<div class='form-check'> <input class='form-check-input' type='checkbox' id='a1'> <label class='form-check-label' for='a1'>Accept</label> </div>
Correct Answer: .form-check .form-switch
<div class='form-check form-switch'> <input class='form-check-input' type='checkbox' id='notify'> <label class='form-check-label' for='notify'>Notifications</label> </div>
Correct Answer: .form-floating
<div class='form-floating'> <input type='email' class='form-control' id='mail' placeholder='name@example.com'> <label for='mail'>Email address</label> </div>
Correct Answer: .input-group-text
<div class='input-group'> <span class='input-group-text'>₹</span> <input class='form-control' type='number'> </div>
Correct Answer: .is-valid
<input class='form-control is-valid' value='ok'>
Correct Answer: .invalid-feedback
<div class='invalid-feedback'>Please enter a valid email.</div>
Correct Answer: .form-control-plaintext
<input type='text' readonly class='form-control-plaintext' value='ID-1024'>
Correct Answer: Use the grid with .row and .col
<div class='row g-3'> <label class='col-sm-3 col-form-label'>Email</label> <div class='col-sm-9'><input class='form-control' type='email'></div> </div>
const form = document.querySelector('form');
form.addEventListener('submit', e => {
if (!form.checkValidity()) { e.preventDefault(); }
form.classList.add('was-validated');
});<label for='pwd' class='form-label'>Password</label> <input id='pwd' class='form-control' aria-describedby='pwdHelp'> <div id='pwdHelp' class='form-text'>Use eight or more characters.</div>
<div class='form-floating'> <input id='emailF' type='email' class='form-control' placeholder=' '> <label for='emailF'>Email</label> </div>
<div class='input-group'> <span class='input-group-text'>%</span> <input class='form-control' type='number' aria-label='Discount percent'> <button class='btn btn-outline-secondary' aria-label='Apply'>Apply</button> </div>
<input class='form-control' type='file' id='resume' accept='.pdf,.docx'> <div class='form-text'>PDF or DOCX, max two megabytes.</div>
<form class='row g-2 align-items-center'> <div class='col-sm-auto'><label for='q' class='visually-hidden'>Search</label><input id='q' class='form-control' placeholder='Search'></div> <div class='col-sm-auto'><button class='btn btn-primary w-100 w-sm-auto'>Go</button></div> </form>
const email = document.querySelector('#em');
email.addEventListener('input', () => {
email.classList.toggle('is-valid', email.checkValidity());
email.classList.toggle('is-invalid', !email.checkValidity());
});