0
0
CSSmarkup~20 mins

Common CSS anti-patterns - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
CSS Anti-Patterns Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Why is using !important considered a CSS anti-pattern?
What is the main problem caused by overusing !important in CSS?
AIt improves page load speed by reducing CSS file size.
BIt automatically fixes browser compatibility issues.
CIt ensures all styles are applied only to the first element on the page.
DIt makes styles harder to override and maintain, causing confusion in large projects.
Attempts:
2 left
💡 Hint
Think about how CSS rules are applied and how !important affects that.
📝 Syntax
intermediate
2:00remaining
What error does this CSS snippet cause?
Consider this CSS code:
div { color: red; font-size 16px; }

What error will this cause?
ASyntax error due to missing colon after <code>font-size</code> property.
BNo error; CSS will apply both styles correctly.
CRuntime error stopping the page from loading.
DThe <code>color</code> property will be ignored but <code>font-size</code> works.
Attempts:
2 left
💡 Hint
Check the syntax for CSS property declarations carefully.
selector
advanced
2:00remaining
Which selector causes the worst performance issue?
Which CSS selector below is considered an anti-pattern because it slows down browser rendering the most?
A*
Bdiv > p > span
Cbody div p span
Dul li:first-child
Attempts:
2 left
💡 Hint
Think about how many elements the selector matches and how browsers process selectors.
layout
advanced
2:00remaining
What is the problem with using float for layout?
Why is using float for page layout considered an anti-pattern in modern CSS?
AFloats automatically center elements horizontally without extra code.
BFloats are deprecated and no longer supported by browsers.
CFloats remove elements from normal flow, causing layout issues and requiring clearfix hacks.
DFloats make elements invisible on mobile devices.
Attempts:
2 left
💡 Hint
Consider how floats affect the position and flow of elements on the page.
accessibility
expert
3:00remaining
Which CSS practice harms accessibility the most?
Which CSS anti-pattern below can make content unreadable or unusable for people with visual impairments?
AUsing semantic HTML elements with proper ARIA roles.
BUsing low contrast colors for text and background.
CUsing relative units like rem and em for font sizes.
DUsing media queries to adjust layout on small screens.
Attempts:
2 left
💡 Hint
Think about how color contrast affects readability for everyone.