0
0
CSSmarkup~5 mins

Common CSS anti-patterns - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the 'Overqualified Selector' anti-pattern in CSS?
It happens when you use too many qualifiers in a selector, like div.header instead of just .header. This makes CSS slower and harder to maintain.
Click to reveal answer
beginner
Why is using !important considered a CSS anti-pattern?
Because it forces styles to override others, making debugging and future changes difficult. It breaks the natural cascading and specificity rules of CSS.
Click to reveal answer
intermediate
What problems arise from using deeply nested selectors in CSS?
Deep nesting creates complex selectors that are hard to read and maintain. It also increases CSS specificity, making overrides tricky and can slow down browser rendering.
Click to reveal answer
beginner
Explain the 'Global Styles' anti-pattern in CSS.
Applying styles globally (like styling all p or div tags) can cause unintended side effects across the site, making it hard to control and predict styling.
Click to reveal answer
beginner
Why is using fixed units like px for font sizes considered an anti-pattern?
Fixed units ignore user preferences and device differences, harming accessibility and responsiveness. Using relative units like em or rem is better.
Click to reveal answer
Which of the following is an example of an overqualified selector?
A.button
Bbutton.primary
C#header
Ddiv.button.primary
What is a major downside of using !important in CSS?
AIt improves performance
BIt makes styles easier to override
CIt breaks natural cascading and makes debugging harder
DIt reduces file size
Why should you avoid deep nesting of selectors?
AIt makes CSS files smaller
BIt increases specificity and reduces maintainability
CIt improves browser rendering speed
DIt helps with responsive design
What problem can global styles cause?
AThey cause unintended styling side effects
BThey improve accessibility
CThey reduce CSS file size
DThey make styles easier to override
Which unit is better for font sizes to support accessibility and responsiveness?
Aem or rem
Bpx
Cpt
Dcm
Describe three common CSS anti-patterns and why they should be avoided.
Think about how these affect maintainability, performance, and debugging.
You got /3 concepts.
    Explain why using fixed units like px for fonts can harm accessibility and responsiveness.
    Consider how users might change font size settings or use different screen sizes.
    You got /3 concepts.