CSS layout quiz

  • Admin
  • 1 min read

Nine questions on Grid, media queries, transitions, custom properties and dark mode.

CSS

CSS layout quiz

9 questions, instant feedback

Question 1 of 9
Question 1 of 9 Which declaration creates three equal columns with Grid?
Why this is the answer

fr units share the available space. repeat(3, 1fr) is the shorthand for the same thing, and grid-template-rows would create rows.

Question 2 of 9
Question 2 of 9 What does grid-column: 1 / 3 do?
Why this is the answer

Grid lines are numbered, and an item spans from the first line to the third, covering two columns.

Question 3 of 9
Question 3 of 9 Which media query targets users who prefer a dark colour scheme?
Why this is the answer

prefers-color-scheme reflects the operating system or browser setting. Pair it with a manual toggle for users who want to override it.

Question 4 of 9
Question 4 of 9 How do you read a custom property named --brand in a rule?
Why this is the answer

var() substitutes the custom property's value. Define it on :root for a site-wide token or on a component for a local override.

Question 5 of 9
Question 5 of 9 Which transition property value animates only the text colour?
Why this is the answer

Naming the property avoids animating layout properties by accident. transition: all can cause jank and unexpected movement.

Question 6 of 9
Question 6 of 9 What does clamp(1rem, 2.5vw, 2rem) do for a font size?
Why this is the answer

clamp takes a minimum, a preferred value and a maximum, which gives fluid type without letting it become unreadably small or huge.

Question 7 of 9
Question 7 of 9 Why is :focus-visible preferred over removing focus outlines?
Why this is the answer

Keyboard users need to see where they are. focus-visible keeps that ring while avoiding a ring after a mouse click, which is why outlines should never simply be removed.

Question 8 of 9
Question 8 of 9 Which unit is best for a gap that should scale with the user's text size?
Why this is the answer

rem follows the root font size, so spacing grows with the reader's settings. px stays fixed regardless of preference.

Question 9 of 9
Question 9 of 9 What is the usual first step when a Grid layout overflows on a narrow screen?
Why this is the answer

Grid items default to a minimum content size. minmax(0, 1fr) lets them shrink, and auto-fit with a sensible minimum reflows columns without a media query.

Your answers stay in this browser. Nothing is sent to a server.