HomeCode HereCSS layout quiz CSS layout quiz Admin 1 min read Updated November 16, 2026 Nine questions on Grid, media queries, transitions, custom properties and dark mode. CSS CSS layout quiz 9 questions, instant feedback Question 1 of 9 Which declaration creates three equal columns with Grid? A grid-template-columns: 1fr 1fr 1fr B grid-columns: 3 C display: flex; columns: 3 D grid-template-rows: repeat(3, 1fr) 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 What does grid-column: 1 / 3 do? A Places the item in column 1 only B Spans the item from column line 1 to line 3 C Creates three columns D Moves the item three places Grid lines are numbered, and an item spans from the first line to the third, covering two columns. Question 3 of 9 Which media query targets users who prefer a dark colour scheme? A @media (dark-mode) B @media (prefers-color-scheme: dark) C @media (color: dark) D @media screen and (theme: dark) 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 How do you read a custom property named --brand in a rule? A color: --brand; B color: var(--brand); C color: custom(--brand); D color: $brand; 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 Which transition property value animates only the text colour? A transition: all 0.2s B transition: color 0.2s C transition: text 0.2s D transition: font 0.2s Naming the property avoids animating layout properties by accident. transition: all can cause jank and unexpected movement. Question 6 of 9 What does clamp(1rem, 2.5vw, 2rem) do for a font size? A Rounds the value to two decimals B Keeps the size between 1rem and 2rem while scaling with the viewport C Sets three fallbacks in order D Disables zoom 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 Why is :focus-visible preferred over removing focus outlines? A It hides focus from keyboard users B It shows a focus ring for keyboard navigation without showing it on every mouse click C It speeds up rendering D It replaces hover styles 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 Which unit is best for a gap that should scale with the user's text size? A px B rem C vh D pt rem follows the root font size, so spacing grows with the reader's settings. px stays fixed regardless of preference. Question 9 of 9 What is the usual first step when a Grid layout overflows on a narrow screen? A Add overflow: hidden B Use minmax(0, 1fr) or auto-fit with a minimum, and check long words C Remove the grid D Set a fixed width 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. Check my answers Try again Your answers stay in this browser. Nothing is sent to a server. More quizzes CSS foundations quiz Coming soon All quizzes