CSS Quiz

Thirty questions covering the whole course. Choose an answer for each, then press Check answers at the bottom to see your score and an explanation for every question.

1. Which way of adding CSS is best for a multi-page website?

2. What does nav a select?

3. What is the specificity of ul li.item:hover?

4. Two rules with equal specificity set the same property. Which wins?

5. Which of these properties is inherited by default?

6. A user sets their browser's default font size to 20px. Which unit respects that?

7. What does clamp(1rem, 2.5vw, 2rem) return on a very wide screen?

8. Where can a custom property declared on :root be used?

9. With box-sizing: content-box, a box has width: 200px; padding: 20px; border: 5px solid. How wide is it on screen?

10. Two paragraphs have margin-bottom: 30px and margin-top: 20px. How much space is between them?

11. Which font-display value shows fallback text immediately and swaps in the web font when it loads?

12. What does display: none do that visibility: hidden doesn't?

13. An element with position: absolute is positioned relative to what?

14. Why might z-index: 9999 fail to put an element on top?

15. In a Flexbox row, which property aligns items vertically?

16. What does flex: 1 on every item in a row do?

17. What does grid-template-columns: 200px 1fr create?

18. Which declaration makes a grid item span from the first column line to the last?

19. What is a "mobile-first" stylesheet?

20. How do container queries differ from media queries?

21. What does margin-inline-start map to in a right-to-left language?

22. Which properties are cheapest to animate?

23. What must a transition have to work?

24. What does object-fit: cover do to an image?

25. What does .card:has(img) select?

26. What is the specificity of :where(#nav .link)?

27. In native CSS nesting, what does &.active inside .tab { } mean?

28. With @layer base, utilities;, a #id rule in base and a .class rule in utilities both set color. Which wins?

29. What does light-dark(white, black) need in order to switch values?

30. What is the minimum WCAG contrast ratio for normal-sized body text?

Want more practice? Try the exercises, or revisit any lesson from the course home.