Top 30 CSS & Design Systems Concepts Quiz
30 multiple-choice questions on the CSS & Design Systems fundamentals, drawn from 30 bites in the CSS & Design Systems library. Answer them here or read straight down. Every question carries the correct option, why it is correct, and a link to the bite it came from.
Tailwind, CSS, accessibility, design tokens
30 questions. Pick an answer, or open “Show the answer” to read it.
Answers are graded in your browser. Nothing is saved, and no XP or streak is earned here. The app keeps score.
Question 1 of 30
Which sequence correctly describes the CSS Cascade's tie-breaking process for style conflicts?
Show the answer
Answer: c · Origin and Importance, then Specificity, then Source Order
The cascade first considers the rule's origin and importance (e.g., !important declarations). If still a tie, it then compares the specificity of the selectors. Finally, if all else is equal, the rule defined later in the code (source order) wins.
Read the full bite: CSS Cascade: How Browsers Resolve Style Conflicts
Question 2 of 30
An HTML div element has id="main" and class="active". Which CSS rule will apply its color?
Show the answer
Answer: c · div#main { color: red; }
The rule div#main has a specificity score of 1-0-1 (one ID, one type selector), which is higher than #main (1-0-0), .active (0-1-0), and div.active (0-1-1) when comparing the scores from left to right. The ID column takes precedence over the class and type columns.
Read the full bite: CSS Specificity: The Browser's Tie-Breaking Rule
Question 3 of 30
An element has width: 200px, padding: 20px, and border: 5px. What is its final rendered width with box-sizing: content-box?
Show the answer
Answer: d · 250px
With box-sizing: content-box, the specified width (200px) applies only to the content area. The padding (20px on each side) and border (5px on each side) are then added outside this content, resulting in a total width of 200 + (2*20) + (2*5) = 250px. Option A (200px) would be the result if box-sizing: border-box were used.
Question 4 of 30
Why do properties like width, margin, and padding typically not inherit in CSS?
Show the answer
Answer: a · Because inheriting them would often lead to broken layouts and unusable pages.
The card explicitly states that properties like width, height, padding, margin, and border do not inherit because it would usually be undesirable, leading to unusable pages. The other options present plausible but incorrect reasons not mentioned in the card.
Question 5 of 30
According to the card, what is a key reason to prefer class selectors over ID selectors when styling reusable UI components?
Show the answer
Answer: a · Class selectors have lower specificity, making their styles easier to override and promoting reusability.
The card explicitly states that ID selectors' "high specificity makes them difficult to override and reduces reusability," while recommending class selectors for "reusable components." Option C is true but does not explain the core reason for preference in terms of styling management.
Read the full bite: CSS Selectors: How to Target HTML for Styling
Question 6 of 30
Which CSS display value allows an element to flow horizontally with surrounding text while still permitting explicit control over its width and height?
Show the answer
Answer: d · inline-block
Inline-block elements combine the characteristics of inline elements by flowing horizontally with text, and block elements by allowing explicit width, height, and vertical margin/padding. Inline elements flow horizontally but ignore width/height, while block elements take a new line.
Read the full bite: CSS 'display': How Elements Occupy Space
Question 7 of 30
You set two elements to "width: 50%" and add "padding: 10px". To guarantee they fit side-by-side without wrapping, which box-sizing value is best?
Show the answer
Answer: c · border-box, as it includes padding within the element's declared width.
With border-box, the element's declared width (50%) includes its padding, ensuring it occupies exactly 50% of the parent's space. content-box, the default, would add the padding outside the 50% width, making each element wider than 50% and causing them to wrap.
Read the full bite: CSS box-sizing: Predictable Element Sizing
Question 8 of 30
What is the primary role of a CSS pseudo-class?
Show the answer
Answer: d · To define styles that activate when an element is in a particular state or position, like being hovered over.
Pseudo-classes are designed to style elements based on their temporary state or structural position, such as when a user hovers over them or when an input is invalid. Option B describes pseudo-elements, which style specific parts of an element, a key distinction mentioned in the card.
Read the full bite: CSS Pseudo-classes: Style Elements Based on State
Question 9 of 30
When using position: absolute on a child element, why might its direct parent be set to position: relative?
Show the answer
Answer: a · To establish a specific positioning context for the child, preventing it from positioning relative to the viewport or document body.
Setting a parent to position: relative creates a positioning context, ensuring that its position: absolute children will position themselves relative to that parent. This prevents the absolutely positioned child from positioning relative to the <body> or another distant ancestor. Position: relative on the parent does not remove it from the normal document flow.
Read the full bite: CSS Positioning: Taking Elements Out of Normal Flow
Question 10 of 30
According to the card, what is the primary design intention behind CSS margin collapsing?
Show the answer
Answer: b · To ensure a consistent and predictable vertical rhythm in document typography.
The card explicitly states that margin collapsing "was designed to create consistent vertical rhythm in documents." While it does prevent margins from adding up, that is a mechanism to achieve the primary goal of aesthetic consistency, not the goal itself.
Read the full bite: CSS Margin Collapsing: The Largest Margin Wins
Question 11 of 30
What is a direct consequence of CSS pseudo-elements not being part of the standard Document Object Model (DOM)?
Show the answer
Answer: c · They cannot be directly selected or manipulated by JavaScript.
The card states, "You cannot attach JavaScript event listeners to them, as they are not in the DOM," directly linking their non-DOM status to JavaScript manipulation limitations. Distractor C is incorrect because the card mentions their styles are dynamic, adapting to layout changes.
Read the full bite: CSS Pseudo-elements: Styling Parts of an Element
Question 12 of 30
Why might an element with z-index: 9999 still appear behind another element with z-index: 10?
Show the answer
Answer: d · The element with z-index: 9999 is a descendant of an element that established a new stacking context, which itself is stacked below the z-index: 10 element.
A new stacking context traps its descendants, meaning they can only stack relative to each other within that context. If the element creating this context is itself stacked below another element (like the z-index: 10 element), its children, regardless of their high z-index, cannot escape to appear above it. Option C is incorrect because while transform creates a stacking context, it doesn't automatically elevate its stacking order above all others; its position is still relative to its parent's context.
Read the full bite: CSS Stacking Contexts: The Z-Axis Explained
Question 13 of 30
Which common layout issue involving a parent container and its floated child elements is directly resolved by establishing a Block Formatting Context (BFC) on the parent?
Show the answer
Answer: d · The parent container's background or border failing to expand and enclose its floated children.
The card explicitly states that a primary use of BFC is to 'contain floats' and gives an example where a parent's border fails to wrap a floated image, which a BFC fixes. While BFCs also prevent margin collapse (Option B), the question specifically asks about issues involving 'parent container and its floated child elements', making float containment the most direct answer.
Read the full bite: Block Formatting Context: Taming Floats and Margins
Question 14 of 30
Which CSS property, applied to an ancestor with `position: static`, would establish it as the containing block for a `position: absolute` child?
Show the answer
Answer: c · transform
The card states that for absolute elements, an ancestor with properties like `transform`, `filter`, or `perspective` will become the containing block, even if its own `position` is `static`. While `position: relative` does create a containing block, it requires the ancestor's position to be non-static, which contradicts the question's premise.
Read the full bite: CSS Containing Block: The Box That Defines Your Box
Question 15 of 30
Which scenario best highlights the primary advantage of using HSL color values in CSS?
Show the answer
Answer: a · When programmatically adjusting color properties like lightness for hover states.
HSL (Hue, Saturation, Lightness) is ideal for programmatic color manipulation, allowing developers to easily create variations like lighter or darker shades. The other options describe the primary use cases for keywords, hexadecimal values, and RGB values, respectively.
Read the full bite: CSS Color Values: From Keywords to Functions
Question 16 of 30
In which scenario would using the CSS font shorthand property be ill-advised?
Show the answer
Answer: a · When you only want to modify font-weight without affecting other inherited font styles.
The card explicitly states to avoid using the font shorthand when only changing a single property, as it would reset other inherited font styles to their initial values. Options A and C describe recommended use cases for the shorthand, while option D describes its primary function, not a reason to avoid it.
Read the full bite: CSS `font`: The All-in-One Typography Shorthand
Question 17 of 30
When should you generally avoid using the CSS `background` shorthand property?
Show the answer
Answer: b · When you only intend to modify one specific background property of an already styled element.
The `background` shorthand resets all unspecified background properties to their default values. Therefore, using it to change only one property on an existing background will inadvertently remove or reset other previously set properties. Options A, B, and D describe scenarios where the shorthand is efficient and recommended.
Read the full bite: CSS `background`: The All-in-One Shorthand
Question 18 of 30
Given the CSS declaration border-radius: 10px 20px;, which corners will receive a 20px radius?
Show the answer
Answer: d · Top-right and bottom-left
The card states that with two values, the first value applies to the top-left and bottom-right corners, while the second value applies to the top-right and bottom-left corners. Therefore, 20px will be applied to the top-right and bottom-left corners. Option B describes the application of the 10px value.
Read the full bite: border-radius: More Than Just Rounded Corners
Question 19 of 30
What is the primary trade-off a developer considers when deciding between a custom font via @font-face and a standard system font?
Show the answer
Answer: d · Achieving a unique brand aesthetic versus optimizing for faster page load times.
The card emphasizes that @font-face is used for specific branding and aesthetics, but warns that "Every custom font adds to the page weight and increases load time." This highlights the core trade-off between design uniqueness and performance. While defining @font-face adds some CSS, the primary decision factor is not the syntax complexity, but the impact on user experience due to load times.
Read the full bite: @font-face: Ship Custom Fonts with Your CSS
Question 20 of 30
What is the primary advantage of using CSS gradients for visual effects like button backgrounds over traditional image files?
Show the answer
Answer: a · They reduce HTTP requests and maintain quality across various screen resolutions.
The card states CSS gradients solve issues like added HTTP requests, increased page weight, and pixelation on high-DPI screens by generating effects directly in the browser. Option D is incorrect because the card advises against using gradients for complex, photorealistic textures.
Question 21 of 30
What happens if the color value is omitted when defining a CSS box-shadow?
Show the answer
Answer: c · The shadow inherits the parent element's computed text color.
The card explicitly states that omitting the color causes the shadow to inherit the parent element's text color, which is a common 'footgun' or pitfall. It does not default to black, become ignored, or inherit the background color.
Read the full bite: CSS box-shadow: Creating Depth and Elevation
Question 22 of 30
Which combination of values is the minimum required to define a single text-shadow?
Show the answer
Answer: b · x-offset and y-offset
The card explicitly states that 'Each shadow is defined by at least two required length values: offset-x and offset-y.' While blur-radius and color are frequently used, they are optional parameters.
Read the full bite: CSS text-shadow: Adding Depth and Legibility to Text
Question 23 of 30
Given `background-image: url('logo.png'), url('pattern.png');` and `background-repeat: no-repeat;`, how does `background-repeat` apply?
Show the answer
Answer: c · Both `logo.png` and `pattern.png` will not repeat.
The card states that if fewer values are provided for a background property than there are images, the browser repeats the list of values. Therefore, the single `no-repeat` value applies to both images. It is not invalid to provide fewer values, nor does it apply only to the first or last layer.
Question 24 of 30
A developer needs to implement a responsive design that dynamically adjusts font weight and width across various screen sizes while minimizing HTTP requests. Which approach is most effective?
Show the answer
Answer: d · Using a single variable font file that defines multiple variation axes.
Variable fonts allow a single file to contain all variations along axes like weight and width, enabling fine-grained adjustments via CSS without multiple HTTP requests, which is ideal for responsive design and performance. Loading separate static files (Option C) would increase HTTP requests and download size, directly contradicting the goal of minimizing requests.
Read the full bite: Variable Fonts: One File, Infinite Styles
Question 25 of 30
When should filter: drop-shadow() be chosen over box-shadow for applying a shadow effect?
Show the answer
Answer: c · To apply a shadow that conforms to the irregular shape of an element's content.
The card states that filter: drop-shadow() is "the best way to apply a shadow to a non-rectangular shape (like a transparent PNG or an SVG)". While filter is hardware-accelerated, the card also advises that box-shadow is more direct and often more performant for simple rectangular shadows, making option B incorrect as a general preference.
Read the full bite: CSS Filter: Photoshop-like Effects in the Browser
Question 26 of 30
Which CSS property is most appropriate for combining multiple background gradients and applying a color tint to a background image within a single element?
Show the answer
Answer: a · background-blend-mode
background-blend-mode is specifically designed for blending multiple background layers (like gradients or images) within a single element, and for applying effects like color tints to background images. mix-blend-mode, while also a blend mode, blends an entire element with the content behind it in the stacking context, not its own background layers.
Read the full bite: CSS Blend Modes: Photoshop Effects in the Browser
Question 27 of 30
When an element has a clip-path applied, how does it interact with the document flow and surrounding elements?
Show the answer
Answer: b · The element's original rectangular box is preserved in the document flow, and surrounding elements behave as if the clipped parts are still present.
The card explicitly states that "clip-path only hides parts of the element visually; it does not change the element's underlying rectangular shape in the document flow. Other elements will not wrap around your custom shape." This means the element continues to occupy its original rectangular space in the layout. Option D describes a common misconception, as clip-path does not alter the element's box model for layout purposes.
Question 28 of 30
Which statement correctly describes the primary function of backdrop-filter in CSS?
Show the answer
Answer: c · It applies graphical effects to the content behind an element, requiring the element itself to be semi-transparent.
backdrop-filter is designed to apply effects to the content *behind* an element, acting like frosted glass, and requires the element to have some transparency to reveal the filtered background. It does not filter the element itself; that is the role of the standard 'filter' property.
Read the full bite: backdrop-filter: Styling What's Behind an Element
Question 29 of 30
When a Flexbox container has flex-direction: column, which statement correctly describes its main and cross axes?
Show the answer
Answer: d · The main axis is vertical, and the cross axis is horizontal.
The card states that flex-direction sets the main axis, and if flex-direction is column, the main axis becomes vertical, with the cross axis automatically perpendicular, hence horizontal. Option B describes the axis orientation for flex-direction: row, which is a common point of confusion.
Read the full bite: CSS Flexbox: Mastering the Main and Cross Axis
Question 30 of 30
For which layout scenario is CSS Grid most appropriately used?
Show the answer
Answer: c · Designing a page's main structure with a header, sidebar, and content area.
The card states that CSS Grid is ideal for the "overall layout of a page, such as creating a classic layout with a header, footer, main content, and sidebars," which aligns with option C. Options A and D describe one-dimensional layouts, for which Flexbox is generally more suitable, and option D is explicitly stated as not being a use case for Grid.
Read the full bite: CSS Grid: Defining a 2D Layout Container
Could you explain these out loud?
That is what an interview actually tests. Tezvyn gives you questions like these with what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.
The iPhone app is on the way
We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.
Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.