If you’re a fresher aiming to land a web development role and Tailwind CSS is on the tech stack, this guide will equip you with the top 5 interview questions and answers.
Q1. What is Tailwind CSS?
Ans: Tailwind CSS is a utility-first CSS framework that provides pre-built utility classes to style your HTML elements directly. Unlike traditional frameworks with pre-defined components, Tailwind gives you granular control over the look and feel of your UI.
Q2. Why use Tailwind CSS?
Ans: Here are some key benefits:
Rapid Development: Quickly style your UI with pre-built classes, reducing development time.
Highly Customizable: Tailwind offers extensive customization options through its configuration file.
Responsive Design: Built-in responsive variants allow for easy adaptation across devices.
Reduced CSS Size: Only the classes you use are included in the final CSS file.
Q3. How do you integrate Tailwind CSS into a project?
Ans: There are two main ways:
Using a CDN: Include the Tailwind CSS library directly from a CDN link in your HTML.
Installing with npm or yarn: Install Tailwind CSS as a package and configure it using a tailwind.config.js file.
Q4. How do you apply text alignment (left, center, right) in Tailwind CSS?
Ans: Use classes like text-left, text-center, and text-right to align text horizontally within an element.
Q5. Explain how to create responsive margins and paddings in Tailwind CSS.
Ans: Tailwind provides responsive variants like sm, md, lg, and xl alongside margin and padding utility classes. For example, mr-4 adds a 1rem margin-right on all screens, while mr-sm-2 adds a 0.5rem margin-right only on small screens.
Top comments (0)