Understanding Utility-First
Which principle best describes the utility-first approach used by Tailwind CSS, as opposed to conventional CSS methodologies?
- A. Writing large CSS files with component classes
- B. Using small, single-purpose classes to construct UI directly in HTML
- C. Emphasizing inheritance over composition
- D. Adopting global CSS resets by default
- E. Relying on pre-built user interface components exclusively
Config Customization
In the Tailwind CSS config file, which key would you update to add a custom background color called 'brand-blue'?
- A. variants.extend.backgroundColor
- B. plugins.colors
- C. theme.extend.backgroundColor
- D. purge.backgroundColor
- E. theme.custom.background
Purging Unused CSS
What is the main function of the 'purge' option in tailwind.config.js?
- A. To minify all JavaScript files in production
- B. To remove unused CSS utilities from the final build
- C. To reset all browser default styles
- D. To generate custom utility classes
- E. To load external CSS frameworks
Variants in Practice
When customizing variants in the Tailwind config file, which scenario best illustrates their purpose?
- A. Adding new fonts to the default theme
- B. Allowing a utility class to respond to 'focus' and 'hover' states
- C. Creating nested CSS classes for child selectors
- D. Adding a new color palette
- E. Compiling Sass files automatically
Using @apply
Given a custom CSS class '.btn-primary' that should include Tailwind's 'bg-blue-500' and 'text-white', which feature allows this composition?
- A. @add
- B. @apply
- C. @compose
- D. @import
- E. @include
Plugin Extension
Suppose you want to add custom utilities globally to your Tailwind project. Where should you register a third-party plugin?
- A. In the variants section
- B. Within the extend object under theme
- C. In the plugins array of tailwind.config.js
- D. In the purge section
- E. As a direct import in main.js
Theme Extension
What is the recommended way to add new spacing values to Tailwind's spacing scale without overwriting the defaults?
- A. Modify the theme.spacing object directly
- B. Add new values under theme.extend.spacing
- C. Insert values in variants.spacing
- D. Place values in plugins.spacing
- E. Update purge.spacing with new values
Responsive Design
How does Tailwind CSS enable you to apply different styles at various screen sizes in your HTML code?
- A. Using @media queries inside custom CSS files
- B. By adding responsive prefixes like 'md:' to utility classes
- C. Defining breakpoints in the purge section
- D. Using only JavaScript to modify classes on resize
- E. Setting .responsive attribute on HTML elements
Custom Fonts
If you want to add a new font family called 'Headline' to your Tailwind project, which config structure is correct?
- A. theme.extend.fonts.Headline = 'Helvetica, Arial'
- B. theme.fontFamily = ['Headline', 'serif']
- C. theme.extend.fontFamily['headline'] = ['Headline', 'sans-serif']
- D. theme.fontFamily.headline = ['Headline', 'sans-serif']
- E. extend.theme.fontFamily['headline'] = ['Headline', 'sans-serif']
Building Custom Utilities
Which approach lets you define a custom utility class that utilizes multiple Tailwind classes (e.g., combining 'uppercase', 'p-4', and 'tracking-wide')?
- A. Use @import followed by the classes
- B. Define the class in your CSS and use the @apply directive with those utilities
- C. Combine the classes in tailwind.config.js under theme.utilities
- D. List the utilities under variants in tailwind.config.js
- E. Register the class in the plugins array only