Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS CSS Foundations Advanced Selectors UI Element States Pseudo-Classes

Richard Terry
PLUS
Richard Terry
Courses Plus Student 15,992 Points

Challenge task 2

We are ask to complete task 2,

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.

I type in,

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

this works in a couple of my browsers but will not work in my challenge box. Any suggestions?

3 Answers

Oisin Kilkenny
Oisin Kilkenny
14,213 Points

The problem is you're using a '+' where you should have a '~'.

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

Hi Oisin,

This answer does pass the challenge but it should not be passing.

The instructions ask you to use the immediate sibling combinator which is +

You have used the general sibling combinator in your answer.

Oisin Kilkenny
Oisin Kilkenny
14,213 Points

I just redid the challenge, and they both seem to work. Probably just and error with the test.

Hi Richard,

Your css is correct. Perhaps there was a little glitch in the challenge.

Richard Terry
PLUS
Richard Terry
Courses Plus Student 15,992 Points

Hi Jason,

Thanks for looking into this. It would work for me with 2 browsers with the +, so I was confused why it would not work on the challenge.