Challenge - 5 Problems
CSS Order Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ selector
intermediate2:00remaining
Which CSS rule applies to the paragraph?
Given these CSS rules, which color will the paragraph text be?
CSS
p { color: blue; }
p { color: red; }Attempts:
2 left
💡 Hint
Later CSS rules override earlier ones if selectors have the same specificity.
✗ Incorrect
CSS applies rules in order. When two rules have the same selector and specificity, the last one wins. Here, the second rule sets the color to red, so the paragraph text will be red.
❓ layout
intermediate2:00remaining
Order of Flexbox properties effect
Consider this CSS for a flex container. Which property order will make the items appear in reverse order visually?
CSS
/* Option 1 */ display: flex; flex-direction: row; /* Option 2 */ display: flex; flex-direction: row-reverse;
Attempts:
2 left
💡 Hint
flex-direction controls the main axis direction and order of items.
✗ Incorrect
Setting flex-direction: row-reverse; reverses the order of flex items visually. The first option keeps normal order.
🧠 Conceptual
advanced2:00remaining
Why does the last CSS rule override earlier ones?
Why does CSS apply the last rule when multiple rules have the same selector and specificity?
Attempts:
2 left
💡 Hint
Think about how CSS processes styles in a file.
✗ Incorrect
CSS applies styles in the order they appear in the stylesheet. If selectors have the same specificity, the later rule overrides earlier ones.
📝 Syntax
advanced2:00remaining
What is the output color of the div?
Given this CSS, what color will the div text be?
CSS
div {
color: green !important;
color: red;
color: blue !important;
}Attempts:
2 left
💡 Hint
!important rules override normal rules, but order matters among !important rules.
✗ Incorrect
Among !important rules, the last one wins. Here, color: blue !important; is last, so the text is blue.
❓ accessibility
expert3:00remaining
How does CSS order affect keyboard navigation?
If you visually reorder elements using CSS
order in Flexbox, how does it affect keyboard navigation order by default?Attempts:
2 left
💡 Hint
Think about how screen readers and keyboard focus work with HTML structure.
✗ Incorrect
Keyboard navigation and screen readers follow the HTML source order, not the visual order changed by CSS order. This can cause confusion if visual and source order differ.