Challenge - 5 Problems
Tailwind Specificity Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate2:00remaining
What does the ! modifier do in Tailwind CSS?
In Tailwind CSS, what is the main purpose of adding an ! before a utility class, like
!text-red-500?Attempts:
2 left
💡 Hint
Think about how CSS specificity works and how Tailwind helps you override styles easily.
✗ Incorrect
The ! modifier in Tailwind adds
!important to the CSS rule, making it override other conflicting styles with lower specificity.📝 Syntax
intermediate2:00remaining
Which Tailwind class applies
color: blue with highest priority?Given these Tailwind classes on a paragraph, which one will make the text color blue and override other color styles?
Tailwind
<p class="text-red-500 !text-blue-500 text-green-500">Hello</p>Attempts:
2 left
💡 Hint
Look for the class with the ! prefix.
✗ Incorrect
The
!text-blue-500 class adds !important making it override text-red-500 and text-green-500 even if they come later.❓ rendering
advanced2:00remaining
What color will the text be rendered with this Tailwind setup?
Consider this HTML snippet with Tailwind classes:
What color will the text inside the <p> tag appear as in the browser?
<div class="text-green-600"> <p class="text-red-600 !text-blue-600">Sample Text</p> </div>
What color will the text inside the <p> tag appear as in the browser?
Attempts:
2 left
💡 Hint
Remember that child element styles override parent styles, and ! adds
!important.✗ Incorrect
The
!text-blue-600 class applies color: blue !important; which overrides both the parent text-green-600 and sibling text-red-600 classes.❓ selector
advanced2:00remaining
Which CSS selector does Tailwind generate for
!bg-red-500?Tailwind uses the ! modifier to add
!important. What does the CSS selector look like for !bg-red-500?Attempts:
2 left
💡 Hint
Tailwind escapes the ! in class names and adds
!important to styles.✗ Incorrect
Tailwind escapes the ! as
\! in the class name and adds !important to the CSS property.❓ accessibility
expert3:00remaining
How does using
!important in Tailwind affect accessibility and maintainability?Which statement best explains the impact of using the ! modifier (adding
!important) in Tailwind CSS on accessibility and maintainability?Attempts:
2 left
💡 Hint
Think about how forcing styles with
!important might interfere with user agent or custom styles.✗ Incorrect
Using
!important can override user agent styles like focus outlines, which are important for keyboard navigation and accessibility. It also makes CSS harder to maintain because overrides become harder to manage.