Tailwind CSS Quiz

Tailwind CSS is a utility-first framework where you style elements by combining small classes. This quiz covers core utilities, responsive prefixes, state variants, configuration and the reasoning behind the utility-first approach.

What this quiz covers

Study tip: Recreate a simple card or navbar using only utility classes; repetition builds the vocabulary faster than reading the docs.

Questions, answers and explanations

1. What is Tailwind CSS?

  1. A JavaScript Framework
  2. A Utility-First CSS Framework
  3. A Database
  4. A Programming Language

Answer: A Utility-First CSS Framework

Tailwind CSS is a utility-first CSS framework used to rapidly build custom user interfaces.

2. Who developed Tailwind CSS?

  1. Evan You
  2. Adam Wathan
  3. Brendan Eich
  4. Mark Otto

Answer: Adam Wathan

Tailwind CSS was created by Adam Wathan.

3. Which command installs Tailwind CSS using npm?

  1. npm install bootstrap
  2. npm install tailwindcss
  3. npm install css
  4. npm install react

Answer: npm install tailwindcss

Tailwind CSS is installed using npm install tailwindcss.

4. Which class sets the background color to blue?

  1. bg-blue-500
  2. text-blue-500
  3. border-blue-500
  4. blue-bg

Answer: bg-blue-500

The bg-blue-500 utility applies a blue background.

5. Which class changes text color to red?

  1. text-red-500
  2. bg-red-500
  3. font-red
  4. red-text

Answer: text-red-500

The text-red-500 utility changes text color to red.

6. Which class makes text bold?

  1. font-bold
  2. text-bold
  3. bold
  4. fw-bold

Answer: font-bold

The font-bold utility applies bold font weight.

7. Which class centers text?

  1. text-center
  2. center
  3. align-center
  4. text-middle

Answer: text-center

The text-center utility aligns text to the center.

8. Which class adds padding on all sides?

  1. p-4
  2. m-4
  3. padding-4
  4. space-4

Answer: p-4

The p-* utilities add padding.

9. Which class adds margin on all sides?

  1. m-4
  2. p-4
  3. margin-4
  4. space-4

Answer: m-4

The m-* utilities add margin.

10. Which class creates rounded corners?

  1. rounded
  2. radius
  3. border-round
  4. curve

Answer: rounded

The rounded utility applies rounded corners.

11. Which Tailwind CSS class sets display to flex?

  1. flex
  2. display-flex
  3. d-flex
  4. flexbox

Answer: flex

The flex utility applies display: flex.

12. Which class aligns items vertically in the center?

  1. items-center
  2. align-center
  3. justify-center
  4. center-items

Answer: items-center

The items-center utility aligns flex items along the cross axis.

13. Which class horizontally centers flex items?

  1. justify-center
  2. items-center
  3. align-center
  4. content-center

Answer: justify-center

The justify-center utility centers items along the main axis.

14. Which class makes an element take the full screen height?

  1. h-screen
  2. h-full
  3. screen-height
  4. full-height

Answer: h-screen

The h-screen utility sets height to 100vh.

15. Which class sets the width to 100%?

  1. w-full
  2. full-width
  3. width-full
  4. w-screen

Answer: w-full

The w-full utility sets width to 100%.

16. Which class applies a shadow to an element?

  1. shadow
  2. box-shadow
  3. shadow-md
  4. Both shadow and shadow-md

Answer: Both shadow and shadow-md

Tailwind provides multiple shadow utilities like shadow, shadow-md, shadow-lg, etc.

17. Which class changes the font size to extra large?

  1. text-xl
  2. font-xl
  3. xl-text
  4. text-large

Answer: text-xl

The text-xl utility sets the font size to extra large.

18. Which class rounds an element into a full circle?

  1. rounded-full
  2. rounded-circle
  3. circle
  4. full-rounded

Answer: rounded-full

The rounded-full utility creates fully rounded elements.

19. Which class adds a hover background color?

  1. hover:bg-blue-500
  2. bg-hover-blue
  3. hover-blue
  4. bg-blue-hover

Answer: hover:bg-blue-500

The hover: variant applies styles when the user hovers over the element.

20. Which Tailwind CSS feature removes unused CSS in production builds?

  1. Purge
  2. Minify
  3. Optimize
  4. Bundle

Answer: Purge

Tailwind removes unused CSS during production using its content scanning (formerly called PurgeCSS).

Take the timed quiz