Advanced CSS Quiz

Test your advanced knowledge of modern CSS

1. Which CSS selector has the highest specificity?
Correct Answer: inline style
Explanation: Inline styles override IDs, classes, and elements.
2. CSS Grid is designed for two-dimensional layouts.
Correct Answer: True
Explanation: Grid works with rows and columns together.
3. Which property creates a stacking context?
Correct Answer: opacity < 1
Explanation: Certain properties create a new stacking context.
4. Which unit is best for responsive typography?
Correct Answer: rem
Explanation: rem scales based on root font size.
5. position: sticky behaves like relative until a scroll threshold.
Correct Answer: True
Explanation: Sticky switches to fixed after scrolling.
6. Which function dynamically clamps values?
Correct Answer: clamp()
Explanation: clamp() sets min, ideal, and max values.
7. CSS variables are scoped.
Correct Answer: True
Explanation: Variables follow normal CSS scoping rules.
8. Which pseudo-class selects the last child?
Correct Answer: :last-child
Explanation: Targets the last child of a parent.
9. Will-change improves animation performance.
Correct Answer: True
Explanation: It hints the browser to optimize rendering.
10. Which layout system supports auto-placement?
Correct Answer: Grid
Explanation: Grid can auto-place items.
11. Which CSS function creates a responsive length between a min, preferred, and max value?
Correct Answer: clamp()
Explanation: clamp() allows a value to stay between a minimum and maximum while scaling responsively.
12. Which pseudo-class selects an element when a user hovers over it?
Correct Answer: :hover
Explanation: :hover targets elements during mouse hover.
13. What does the CSS property isolation: isolate do?
Correct Answer: Prevents an element from affecting z-index stacking
Explanation: isolation: isolate creates a new stacking context.
14. The minmax() function is commonly used in which layout?
Correct Answer: Grid
Explanation: minmax() sets minimum and maximum track sizes in CSS Grid.
15. Which property allows an element to ignore pointer events?
Correct Answer: pointer-events: none
Explanation: This property disables mouse interactions on the element.
16. Which pseudo-element is used to insert content before an element?
Correct Answer: ::before
Explanation: ::before adds content before the element’s content.
17. CSS subgrid is currently supported in most modern browsers.
Correct Answer: False
Explanation: Subgrid has limited support; check browser compatibility.
18. Which CSS property controls the rendering order of flex items along the main axis?
Correct Answer: order
Explanation: The order property changes the visual order of flex items.
19. Which property allows smooth transitions for changing CSS properties?
Correct Answer: transition
Explanation: transition smooths property changes over time.
20. Which unit adapts to viewport width?
Correct Answer: vw
Explanation: 1vw equals 1% of the viewport width.