Recall & Review
beginner
What is CSS specificity?
CSS specificity is a set of rules browsers use to decide which CSS rule applies when multiple rules target the same element. It works like a score system based on selectors used.
Click to reveal answer
beginner
How do inline styles affect CSS specificity?
Inline styles have the highest specificity and override most other CSS rules except for !important declarations.
Click to reveal answer
intermediate
What is the specificity order from lowest to highest?
Element selectors (e.g., div) < Class selectors (e.g., .class) < ID selectors (e.g., #id) < Inline styles.Click to reveal answer
intermediate
How can you debug specificity issues in the browser?
Use browser DevTools to inspect the element, check the Styles pane to see which rules apply and which are overridden, and look at the specificity scores or crossed-out styles.
Click to reveal answer
beginner
What does the !important declaration do in CSS?
The !important declaration forces a CSS rule to override other rules regardless of specificity, but it should be used sparingly to avoid confusion.
Click to reveal answer
Which selector has the highest specificity?
✗ Incorrect
ID selectors have higher specificity than class, element, or universal selectors.
What happens if two CSS rules have the same specificity?
✗ Incorrect
When specificity is equal, the later rule in the CSS file overrides earlier ones.
How can you check which CSS rule is applied to an element?
✗ Incorrect
Browser DevTools show applied and overridden CSS rules for any element.
Which of these increases specificity the most?
✗ Incorrect
ID selectors add more specificity than classes, elements, or pseudo-classes.
What is the effect of !important in CSS?
✗ Incorrect
!important forces a CSS rule to override others, ignoring normal specificity rules.
Explain how CSS specificity works and why it matters when styling a webpage.
Think about how multiple rules can target the same element.
You got /3 concepts.
Describe steps you would take to debug a CSS specificity issue using browser tools.
Use the Styles pane in DevTools to see which rules win.
You got /4 concepts.