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 trial

CSS CSS Foundations Advanced Selectors UI Element States Pseudo-Classes

Devin Scheu
Devin Scheu
66,191 Points

I need some help with selectors

I can't seem to figure out what's wrong.

here's the question: Now, create an attribute selector that targets input elements with a type value of radio. In the same selector, add the :checked pseudo class, then use a combinator to target the label that is an immediate sibling of a radio button. Set the color to blue and the font weight to bold.

And here is my code:

input [type="radio"] :checked {

  color: blue;

  font-weight: bold;

}

1 Answer

Erik McClintock
Erik McClintock
45,783 Points

Devin,

You're most of the way there! You need to remove all the spaces from your selector, but beyond that, you're just missing the combinator part of the selector to access labels that are immediate siblings of those inputs of type radio that are checked. Remember, the combinator is the + sign.

input[type=radio]:checked+label {
  color: blue;
  font-weight: bold;
}

Hope this helps!

Erik

idan ben yair
idan ben yair
10,288 Points

Great Erik thanks! I was stuck on the same thing.

Devin Scheu
Devin Scheu
66,191 Points

Thank you very much, this helped alot!