
Quiz in CSS
? CSS Quiz: Test Your Knowledge!
Here’s a quick CSS quiz to challenge your understanding — great for practice or interviews.
? Multiple Choice Questions
1. What does the z-index
property do?
A. Resizes the element
B. Sets the stacking order of elements
C. Aligns text vertically
D. Changes the opacity
Answer: B
2. Which unit is relative to the parent’s font size?
A. px
B. em
C. %
D. rem
Answer: B
3. What value of position
is used to fix an element to the top of the viewport when scrolling?
A. relative
B. absolute
C. fixed
D. static
Answer: C
4. Which property hides content that overflows a container?
A. display
B. visibility
C. overflow
D. z-index
Answer: C
5. What does the ::after
pseudo-element require to work?
A. A z-index
B. An id
C. The content
property
D. A background color
Answer: C
? True or False
6. The !important
rule can be overridden by another rule with higher specificity.
False —
!important
takes top priority unless another!important
with higher specificity is used.
7. inline-block
allows width and height to be set.
True
? Want More?
I can give you:
A full interactive quiz in HTML/JS
Flashcards for CSS topics
Interview-style CSS coding questions
Just let me know what format you’d like!