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 trialRichard Terry
Courses Plus Student 15,992 PointsChallenge 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
14,213 PointsThe problem is you're using a '+' where you should have a '~'.
input[type=radio]:checked ~ label{
color: blue;
font-weight: bold;
}
Jason Anello
Courses Plus Student 94,610 PointsHi Richard,
Your css is correct. Perhaps there was a little glitch in the challenge.
Richard Terry
Courses Plus Student 15,992 PointsHi 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.
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsHi 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
14,213 PointsOisin Kilkenny
14,213 PointsI just redid the challenge, and they both seem to work. Probably just and error with the test.