0
0
CSSmarkup~20 mins

Group selectors in CSS - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Group Selector Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
selector
intermediate
2:00remaining
What elements are styled by this CSS rule?
Given the CSS rule h1, p, .highlight { color: red; }, which elements will have red text?
AOnly <h1> elements and elements with class 'highlight'
BAll <h1>, <p> elements, and elements with class 'highlight'
COnly <p> elements and elements with class 'highlight'
DOnly elements with class 'highlight'
Attempts:
2 left
💡 Hint
Remember that group selectors apply the same style to all listed selectors.
📝 Syntax
intermediate
2:00remaining
Identify the syntax error in this group selector
Which option shows the correct way to write a group selector for <h2>, <div>, and elements with class 'note'?
Ah2 div .note { font-weight: bold; }
Bh2; div; .note { font-weight: bold; }
Ch2 div, .note { font-weight: bold; }
Dh2, div, .note { font-weight: bold; }
Attempts:
2 left
💡 Hint
Group selectors are separated by commas, not spaces or semicolons.
rendering
advanced
2:00remaining
What color will the text be for <p class='highlight'> in this CSS?
Consider this CSS:
p, .highlight { color: blue; }
.highlight { color: green; }

What color will the text inside <p class='highlight'> be?
CSS
<p class='highlight'>Hello</p>
ABlue
BBlack (default)
CGreen
DBoth blue and green (mixed)
Attempts:
2 left
💡 Hint
Later rules override earlier ones if selectors have the same specificity.
accessibility
advanced
2:00remaining
How does grouping selectors affect accessibility styling?
If you want to increase font size for all headings (<h1>, <h2>, <h3>) and paragraphs with class 'important' for better readability, which CSS rule is best?
Ah1, h2, h3, .important { font-size: 1.5rem; }
Bh1 h2 h3 .important { font-size: 1.5rem; }
Ch1; h2; h3; .important { font-size: 1.5rem; }
Dh1 + h2 + h3 + .important { font-size: 1.5rem; }
Attempts:
2 left
💡 Hint
Use commas to group selectors for applying the same style to multiple elements.
🧠 Conceptual
expert
2:00remaining
How many elements are affected by this CSS group selector?
Given the HTML:
<h1>Title</h1>
<p>Paragraph</p>
<div class='note'>Note</div>
<span class='note'>Span Note</span>

And CSS:
h1, p, .note { color: purple; }

How many elements will have purple text?
A4
B3
C2
D1
Attempts:
2 left
💡 Hint
Count all elements matching any selector in the group.