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
Accenture · Tailwind CSS
Practice Tailwind CSS questions specifically asked in Accenture interviews – ideal for online test preparation, technical rounds and final HR discussions.
Questions
65
Tagged for this company + subject
Company
Accenture
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 Accenture 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.
Extending the theme allows teams to define shared design tokens for colors, fonts, spacing, and breakpoints. This creates a single source of truth for UI consistency.
theme: { extend: { colors: { brand: '#2563EB' } } }Tailwind CSS is known for its utility-first approach. Instead of writing custom CSS, you combine small utility classes directly in your HTML to style elements quickly and consistently.
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'
Tailwind uses the 'bg-' prefix for background colors. For example, 'bg-blue-500' applies a mid-tone blue color from the palette. You can use shades 50 to 900 to adjust brightness.
class='bg-blue-500 text-white'
Ring utilities create an outline outside the element’s border, often used for focus states. For example, 'ring-2 ring-blue-500' highlights form inputs when active.
class='focus:ring-2 focus:ring-blue-500'
The 'hover:' prefix applies a style when the user hovers over an element. It’s commonly used for button, link, or card hover effects in Tailwind.
class='bg-blue-500 hover:bg-blue-700'
The 'transition' class enables smooth transitions for style changes like color, background, or transform. It’s often used with hover effects to create polished UI interactions.
class='transition duration-300 hover:bg-blue-600'
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}']JIT mode compiles classes as you use them in your project instead of generating all possible combinations. It makes builds faster and CSS files smaller.
npx tailwindcss -i ./src/input.css -o ./dist/output.css --watch
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 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.
The tailwind.config.js file controls how Tailwind behaves. It allows you to customize colors, fonts, spacing, breakpoints, and other design settings. It acts like the control center for your entire Tailwind setup.
npx tailwindcss init
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}']The spacing scale defines values for padding, margin, and gap utilities. By extending theme.spacing, you can create consistent custom spacing sizes like 18px or 72px across your app.
theme: { extend: { spacing: { '18': '4.5rem' } } }The 'flex' class applies display: flex to an element, enabling Flexbox layout. Once active, you can use other flex utilities to control direction, alignment, and spacing.
class='flex items-center justify-between'
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 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'
The 'text-lg' class increases the font size to the large preset value. Tailwind provides a full scale from text-xs to text-9xl for flexible typography.
class='text-lg font-semibold'
Tailwind’s 'text-center' class applies text-align: center, making it easy to center headings, paragraphs, or button labels.
class='text-center text-gray-700'
Tailwind uses 'tracking-' utilities to set letter spacing. 'tracking-wide' adds more space between characters, useful for headings or uppercase text.
class='tracking-wide uppercase'
Tailwind provides font utilities like font-sans, font-serif, and font-mono. 'font-sans' applies the default sans-serif stack for modern clean typography.
class='font-sans text-gray-800'
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-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 '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'
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 supports blend modes for creative effects. 'bg-blend-multiply' blends the background image and color by multiplying their values, adding depth or color tone.
class='bg-blend-multiply bg-blue-500 bg-[url(bg.jpg)]'
Tailwind follows a mobile-first approach. All classes apply to mobile by default, and you can add breakpoint prefixes like 'md:' or 'lg:' to style larger screens progressively.
class='text-sm md:text-lg lg:text-xl'
The 'container' class in Tailwind provides a responsive fixed width that adapts at different breakpoints. It’s ideal for wrapping main content areas.
class='container mx-auto px-4'
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 '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 '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 'group-hover' variant allows child elements to react to the hover state of a parent with the 'group' class. It’s powerful for creating interactive card or dropdown animations.
<div class='group hover:bg-gray-100'><p class='group-hover:text-blue-500'>Hover me</p></div>
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 '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 'translate-x-4' utility shifts the element horizontally by 1rem to the right. Negative versions like '-translate-x-4' move it left.
class='transform hover:translate-x-4'
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'
A simple button uses background color, text color, and border-radius utilities. The 'bg-blue-500 text-white rounded' combo is one of the most common in Tailwind projects.
class='bg-blue-500 text-white px-4 py-2 rounded hover:bg-blue-600'
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'
The 'rounded-full' class sets a full border radius, while 'object-cover' ensures the image fills its container without distortion — ideal for profile avatars.
class='w-20 h-20 rounded-full object-cover'
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'
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 React, you install Tailwind with PostCSS and Autoprefixer for processing CSS. After installation, you create a Tailwind config and import the directives into index.css.
npm install tailwindcss postcss autoprefixer
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.
Apply the class .form-select to a select element. It adds proper height, padding, and a styled arrow that matches the Bootstrap theme.
<select class='form-select'><option>One</option></select>
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>
Inside an input group, wrap any prefix or suffix text in a span with the class .input-group-text. It keeps the text vertically aligned with the input and maintains consistent spacing.
<div class='input-group'> <span class='input-group-text'>₹</span> <input class='form-control' type='number'> </div>
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>