Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialThomas Weld
12,293 PointsI don't get it? "use a combinator to target the label that is an immediate sibling of a radio button. "
I've looked up other Q&A on this same question.. it looks like I've got the same code and it's not accepting it ?? Also, I just don't understand how "label" is selecting immediate sibling of a radio button...
Thomas Weld
12,293 PointsAlso, I just don't understand the statement and what exactly I'm doing by using "label" .. how does this select an immediate sibling of a radio button?
1 Answer
Jason Anello
Courses Plus Student 94,610 PointsHi Thomas,
You have a space before checked
Should be `input[ type="radio"]:checked + label { color:blue; font-weight:bold; }
It might help to look at the html.
<input name="radio" id="radio1" type="radio"><label for="radio1">Option 1</label>
The label is an immediate sibling to the radio button. It comes right after it. The challenge is trying to get you to select that label.
You can do this with the +
combinator which is the immediate sibling combinator.
There are other labels in the html for phone and name but they won't be selected because they're not immediate siblings to a radio input.
Thomas Weld
12,293 PointsOk, that makes more sense. Thanks for the explanation Jason.
Jason Anello
Courses Plus Student 94,610 PointsYou're welcome.
Thomas Weld
12,293 PointsThomas Weld
12,293 PointsHere is the CSS -- it's telling me, make sure I've set font weight to 'bold' ???
:disabled { background-color:lightgray;}
input[ type="radio"]: checked + label { color:blue; font-weight:bold; }