1. Which build process ensures Tailwind CSS performs efficiently in large apps?
Using PostCSS with purge and minify ensures only used styles remain in production, reducing file size and boosting loading speed.
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
Wipro · Tailwind CSS
Practice Tailwind CSS questions specifically asked in Wipro interviews – ideal for online test preparation, technical rounds and final HR discussions.
Questions
75
Tagged for this company + subject
Company
Wipro
View company-wise questions
Subject
Tailwind CSS
Explore topic-wise practice
Go through each question and its explanation. Use this page for targeted revision just before your Wipro Tailwind CSS round.
Using PostCSS with purge and minify ensures only used styles remain in production, reducing file size and boosting loading speed.
For complete preparation, combine this company + subject page with full company-wise practice and subject-wise practice. You can also explore other companies and topics from the links below.
Wrap each checkbox or radio input inside a .form-check div. The input should use .form-check-input and the label should use .form-check-label for correct spacing and alignment.
<div class='form-check'> <input class='form-check-input' type='checkbox' id='a1'> <label class='form-check-label' for='a1'>Accept</label> </div>
When you use 'extend', Tailwind keeps its default values and adds yours on top. Using 'theme' replaces the defaults entirely, which is useful if you want to create a fully custom design system.
theme: { extend: { colors: { brand: '#1E40AF' } } }Custom fonts are defined in the fontFamily section of the theme object. Once added, they can be applied with utility classes like font-sans or font-display. This helps maintain consistent typography throughout your project.
theme: { extend: { fontFamily: { sans: ['Inter', 'sans-serif'] } } }In Tailwind’s default theme, 'lg:' begins at 1024px. It’s typically used for larger laptops and desktops.
class='text-base lg:text-xl'
The 'gap' utility defines consistent spacing between items in Flex or Grid containers without adding extra margin or padding. It's cleaner than manually spacing each item.
class='flex gap-4'
The 'container' class gives your layout a responsive fixed width that adapts at different screen sizes. It is commonly used to center page content.
class='container mx-auto px-4'
Tailwind color classes follow the pattern text-color-shade. 'text-blue-500' sets text color to a specific blue tone from the palette. The 500 shade is often the base color.
class='text-blue-500 hover:text-blue-700'
Tailwind’s spacing scale is based on a multiple of 0.25rem. 'p-4' means padding of 1rem (4 × 0.25rem). Similarly, 'm-4' adds 1rem margin.
class='p-4 m-2'
The 'uppercase' class transforms text to all capital letters. Tailwind also includes 'lowercase' and 'capitalize' for other text transformations.
class='uppercase tracking-widest'
The 'hidden' class hides an element, and combining it with breakpoints controls visibility. For example, 'sm:hidden lg:block' hides content on small screens but shows it on large ones.
class='sm:hidden lg:block'
A card component usually uses 'shadow-lg' for depth, 'rounded-lg' for corners, padding for spacing, and a neutral background. Together they create clean, reusable blocks.
class='bg-white rounded-lg shadow-lg p-4'
Using Flexbox utilities 'flex justify-between items-center' creates a responsive navbar with evenly spaced items on both sides.
class='flex justify-between items-center px-6 py-4 bg-gray-800 text-white'
Tailwind scans all specified content paths and removes unused classes during the build. This keeps production bundles lightweight and fast.
content: ['./src/**/*.{js,jsx,ts,tsx,html}']To use Tailwind in your project, you install it using npm install tailwindcss and initialize it with npx tailwindcss init. This generates the configuration file for customization.
npm install tailwindcss npx tailwindcss init
Each Tailwind utility class applies a single, specific CSS property — like margin, padding, color, or font-size. Combining multiple utilities builds complex designs without writing new CSS.
class='text-center text-blue-500 font-bold'
Tailwind speeds up development by letting developers use small, reusable utility classes instead of writing long CSS files. This reduces context switching between HTML and CSS.
Tailwind is added to your main CSS file using @tailwind base, @tailwind components, and @tailwind utilities directives. These import the framework’s styles into your project.
@tailwind base; @tailwind components; @tailwind utilities;
JIT (Just-In-Time) mode generates CSS only for the classes you use in your files. It’s faster and more efficient, making builds lightweight and instant during development.
Tailwind scans your content files to find all used classes. Defining content paths ensures only those classes are included in the final CSS, keeping the build small. It’s essential for PurgeCSS and JIT mode to work efficiently.
content: ['./src/**/*.{html,js,jsx,ts,tsx}']Plugins extend Tailwind by adding new utilities, components, or variants. For example, the official typography and forms plugins enhance readability and form styling automatically.
plugins: [require('@tailwindcss/typography')]Tailwind uses 'flex-col' to make items align vertically. By default, 'flex' arranges children in a row. Changing it to column stacks them top to bottom.
class='flex flex-col gap-4'
The 'justify-center' class aligns items along the main axis of the Flex container. In a row direction, it centers items horizontally.
class='flex justify-center'
The 'grid' class applies display: grid. You can then use 'grid-cols-' or 'grid-rows-' utilities to define columns or rows for your layout.
class='grid grid-cols-3 gap-6'
The class 'grid-cols-3' divides the container into three equal-width columns. You can use 'gap' utilities to control spacing between them.
class='grid grid-cols-3 gap-4'
The 'flex-wrap' class lets items move onto new lines when they overflow the container width. It’s often used with grids or lists to keep layouts neat.
class='flex flex-wrap gap-2'
By default, grids fill rows first. The 'grid-flow-col' class makes grid items flow across columns instead, changing how new items are placed in the grid.
class='grid grid-flow-col gap-4'
Tailwind uses the 'font-' prefix for weight control. 'font-bold' applies font-weight: 700 to make text bold and visually stronger.
class='font-bold text-gray-800'
The 'bg-' prefix in Tailwind defines background colors. 'bg-red-500' applies a moderate red tone, while you can use different shades from 100 to 900 for variations.
class='bg-red-500 text-white'
The 'leading-' utilities control line height. For example, 'leading-tight' reduces spacing between lines while 'leading-loose' increases it, improving text readability.
class='text-lg leading-relaxed'
The 'mx-auto' class applies margin-left and margin-right as auto, which centers block elements like divs or containers horizontally.
class='w-1/2 mx-auto'
The 'antialiased' utility improves text rendering on screens by smoothing edges, making fonts look cleaner and more polished.
class='antialiased text-gray-900'
The 'bg-gradient-to-r' class creates a gradient background that flows from left to right. Combine it with 'from-' and 'to-' color utilities to control the gradient direction and colors.
class='bg-gradient-to-r from-blue-400 to-green-500'
The 'bg-gradient-to-b' class creates a gradient that moves vertically from top to bottom. You can pair it with 'from-' and 'to-' colors for smooth transitions.
class='bg-gradient-to-b from-purple-400 to-indigo-700'
The 'bg-no-repeat' class sets background-repeat to none. It’s commonly used with custom background images to prevent tile repetition.
class='bg-no-repeat bg-cover bg-center'
The 'border-red-500' utility applies a red color from the Tailwind palette to the element’s border. It can be combined with 'border' or 'border-2' for visibility.
class='border border-red-500 rounded-lg'
Tailwind’s border utilities define border thickness. 'border-2' applies a consistent 2-pixel border to all sides. You can also target specific sides like border-t or border-b.
class='border-2 border-gray-400'
The 'rounded-full' class gives an element maximum border-radius, making it completely circular when width and height are equal. It’s commonly used for avatars or buttons.
class='w-16 h-16 rounded-full bg-blue-500'
Tailwind includes predefined shadow utilities like shadow-sm, shadow-md, and shadow-xl. 'shadow-md' provides a balanced depth for cards and containers.
class='bg-white p-6 shadow-md rounded-lg'
Tailwind’s rounding scale ranges from rounded-none to rounded-full. 'rounded-sm' applies a small, subtle radius for a clean and minimal edge effect.
class='rounded-sm border border-gray-300'
The 'animate-spin' class rotates the element continuously, often used for loading icons or progress indicators.
class='animate-spin h-6 w-6 text-blue-500'
The 'md:' prefix applies styles when the screen width is at least 768 pixels. Tailwind uses min-width breakpoints, meaning the style applies from that size and up.
class='bg-blue-300 md:bg-green-300'
Tailwind allows responsive styling by prefixing classes with breakpoints. For example, 'sm:p-2' applies at small screens, while 'lg:p-6' applies from 1024px and above.
class='p-1 sm:p-2 lg:p-6'
You can enable dark mode either based on user’s OS setting ('media') or manually using the 'class' strategy in Tailwind’s configuration file.
module.exports = { darkMode: 'class' }The 'dark:' prefix applies a class only when dark mode is active. It allows developers to easily create light and dark themes with the same structure.
class='bg-white dark:bg-gray-900'
The 'media' strategy uses the CSS media query '(prefers-color-scheme: dark)' to automatically switch themes based on system preferences.
The 'bg-cover' class ensures that the background image scales proportionally to completely cover the element, maintaining its aspect ratio.
class='bg-cover bg-center'
The 'focus:' variant activates when an input or button receives keyboard or mouse focus. It’s useful for accessibility and visual feedback in forms.
class='focus:outline-none focus:ring-2 focus:ring-blue-500'
The 'active:' variant applies styles while an element is in the pressed state. It’s typically used to make buttons feel responsive to user clicks.
class='bg-blue-600 active:bg-blue-800'
The 'disabled:' prefix applies styles only when an element is disabled. For example, 'disabled:opacity-50' dims a button to show it's inactive.
class='bg-blue-500 disabled:bg-gray-400 disabled:cursor-not-allowed'
The 'peer' class marks an element that others can reference with 'peer-*' variants. It’s useful for form interactions like showing messages when a checkbox is checked.
<input type='checkbox' class='peer'><p class='peer-checked:block hidden'>Visible on check</p>
The 'focus-visible:' variant helps improve accessibility by styling elements only when focused through keyboard navigation, not by mouse clicks.
class='focus-visible:ring-2 focus-visible:ring-indigo-500'
The 'odd:' and 'even:' variants apply styles to alternating elements, commonly used in tables or lists to enhance readability.
class='odd:bg-gray-100 even:bg-white'
The 'duration-' utilities define how long a transition takes. For instance, 'duration-500' means the transition completes in 0.5 seconds.
class='transition duration-500 ease-in-out'
The 'delay-' utilities add a wait time before the transition begins. For example, 'delay-300' waits 300 milliseconds before animating the property.
class='transition delay-300 hover:opacity-80'
The 'ease-in' easing function starts the animation slowly and speeds up toward the end, giving a natural acceleration effect.
class='transition ease-in duration-300'
The 'scale-110' class increases the element’s size by 10%. It requires the 'transform' utility to be active for the effect to apply properly.
class='transform hover:scale-110'
The 'rotate-45' utility rotates the element by 45 degrees clockwise. You can combine it with hover states for interactive rotation effects.
class='transform hover:rotate-45'
The 'animate-ping' class creates a pulsing ring effect where the element grows and fades, mimicking a radar or ripple motion.
class='animate-ping absolute h-4 w-4 bg-blue-400 rounded-full'
The 'animate-pulse' animation repeatedly fades elements in and out softly, often used to indicate loading or active states.
class='animate-pulse bg-gray-200 h-6 w-32'
The 'fixed inset-0' combo positions the modal overlay across the full viewport. 'w-full h-full' ensures the overlay spans the entire width and height.
class='fixed inset-0 w-full h-full bg-black/50 flex items-center justify-center'
Tailwind’s grid utilities make multi-column layouts simple. 'grid grid-cols-3 gap-4' divides the container into three equal columns with spacing between them.
class='grid grid-cols-3 gap-4'
Badges or tags are usually small inline-block elements with soft colors and full rounding for pill shapes. Tailwind utilities make them quick to style.
class='inline-block px-2 py-1 text-xs font-semibold rounded-full bg-green-100 text-green-800'
Tailwind’s responsive utilities let you change layout per breakpoint. 'flex flex-col md:flex-row' stacks items vertically on mobile and horizontally on desktops.
class='flex flex-col md:flex-row gap-4'
Combining 'flex items-center justify-center' centers content in both directions — perfect for modals, icons, or loaders.
class='flex items-center justify-center h-screen'
Tailwind provides various shadow depths. 'shadow-xl' gives more elevation, making elements pop visually on light backgrounds.
class='bg-white rounded-lg shadow-xl p-6'
In Next.js, you typically import Tailwind’s compiled CSS inside app.js or the root layout file. This ensures all components inherit its utility styles globally.
import '../styles/globals.css';
The @apply directive lets you create custom reusable class definitions by combining Tailwind utilities inside your CSS. It helps reduce duplication.
@layer components { .btn { @apply px-4 py-2 bg-blue-500 text-white rounded; } }Tailwind’s responsive utilities like 'w-full sm:w-1/2' make images fluid. Combined with Next.js's Image component, it ensures adaptive performance across devices.
class='w-full sm:w-1/2 rounded-lg'
You can combine Tailwind and styled-components using the @apply directive to inject utility styles directly into CSS-in-JS blocks for hybrid styling flexibility.
Use the class .form-control on inputs and textareas to give them consistent padding, border, and focus styles. It ensures the elements align neatly with other form components.
<input type='text' class='form-control' placeholder='Your name'>
Add the class .form-switch to a .form-check wrapper. Keep the input as a checkbox. Bootstrap will automatically style it to look like a toggle 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>
Use .is-valid to show a green border and .is-invalid for a red one. These classes work best with feedback messages to guide the user through form validation.
<input class='form-control is-valid' value='ok'>
Use .invalid-feedback for error text and .valid-feedback for success messages. These stay hidden until the input becomes invalid or valid within a validated form.
<div class='invalid-feedback'>Please enter a valid email.</div>
Bootstrap 5 no longer includes .form-row. To build horizontal forms, use the standard grid with .row and .col classes so labels and controls align responsively.
<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>