0
0
Tailwindmarkup~20 mins

Class conflict resolution strategies in Tailwind - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Tailwind Conflict Resolver
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
How does Tailwind CSS resolve conflicting utility classes?
In Tailwind CSS, when two utility classes conflict (for example, bg-red-500 and bg-blue-500 applied to the same element), how does the browser decide which style to apply?
AThe last class listed in the HTML element's class attribute takes precedence due to CSS cascading rules.
BTailwind automatically merges conflicting classes and creates a new combined class.
CTailwind uses JavaScript to dynamically remove conflicting classes at runtime.
DThe first class listed in the HTML element's class attribute always overrides the others.
Attempts:
2 left
💡 Hint
Think about how CSS applies styles when multiple rules target the same property.
📝 Syntax
intermediate
1:30remaining
Which Tailwind class order produces a blue background?
Given this HTML element: <div class="bg-red-500 bg-blue-500">Hello</div>, what background color will the element have when rendered in the browser?
APurple background
BRed background
CNo background color
DBlue background
Attempts:
2 left
💡 Hint
Remember the order of classes affects which style applies.
selector
advanced
2:30remaining
How to override Tailwind utility with custom CSS?
You have a button with class text-green-600 from Tailwind. You want to override its text color to red using your own CSS. Which CSS selector will correctly override the Tailwind style?
Abutton.text-green-600 { color: red; }
B.text-green-600 { color: red; }
C.text-green-600 { color: red !important; }
Dbutton { color: red; }
Attempts:
2 left
💡 Hint
Tailwind utilities have high specificity; you may need to increase specificity or use !important.
layout
advanced
2:00remaining
What happens when conflicting flexbox classes are applied?
Consider this element: <div class="flex flex-col flex-row">Content</div>. What will be the layout direction of the flex container?
AThe flex container will arrange children in a column (vertical).
BThe flex container will arrange children in a row (horizontal).
CThe flex container will not apply any flex layout.
DThe layout will be broken and children will overlap.
Attempts:
2 left
💡 Hint
Check which class comes last and what CSS property it sets.
accessibility
expert
3:00remaining
How to resolve conflicting focus ring styles in Tailwind?
You have a button with classes focus:ring-2 focus:ring-blue-500 focus:ring-offset-4 focus:ring-offset-red-300. Which focus ring color and offset will the button show when focused?
AA blue ring with a red offset around the button.
BA red ring with a blue offset around the button.
CNo visible focus ring due to conflict.
DA default browser focus ring ignoring Tailwind classes.
Attempts:
2 left
💡 Hint
Focus ring color and offset are controlled by separate classes that do not conflict.