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

UI element states pseudo classes—where am I going wrong?

Question is...

"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."

my answer is...

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

not sure where I'm going wrong? Anyone able to help me out please?

2 Answers

Sreng Hong
Sreng Hong
15,083 Points

Hi Philip!!! Here is the code that I passed the challenge.

:disabled {
  background-color: lightgrey;
}

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

As I see your code, I think it's the same as mine, so please recheck your typo and try to take the challenge again. Hope it helps.

Thanks Sreng,

I couldn't see anything different other than your code being across multiple lines, where mine was just two. Anyway, I copied and pasted and passed, so thanks again for your help.

Hi Philip,

Your css is fine. I would copy your code, refresh the challenge, and paste it back in.

I don't know if you started off with a wrong answer and then fixed it but occasionally this seems to cause a challenge not to pass.

Thanks for your help Jason,

I managed to pass by spreading it across multiple lines. I don't know if it made any technical difference, but it seemed to make it work.

Thanks for your suggestion.

Being one line shouldn't make any difference. I copied and pasted your css as is into the challenge and it passed.

You would want to write it out like Sreng has shown for readability purposes.