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

Jamie Winspear
Jamie Winspear
4,321 Points

Pseudoclasses : disabled

I am currently trying to work through the two challenges on the "ui element states pseudoclasses" deep dive. I am being asked to apply a background-color: lightgray to a disabled form class. My css code is input[type="text"] : disabled { background-color: lightgrey;} which is having the desired effect on the preview, and yet my challenge is not completing. Is there a problem with my code, or with the client? I'm not experienced enough to tell

4 Answers

Edit: In reference to the question - "Do the spaces matter in "actual" coding?" Should have did a comment.
Edit 2 Should have said, "Whitespace is the combinator used in a descendant selector.

Yes, they do. Whitespace is the descendant selector.

div.main means, select a div with a class of "main"

div .main (with space) means, select any element with a class of "main" that is inside of a div.

Two completely different things because of the space.

Callum King
Callum King
6,470 Points

Should be input[type="text"]:disabled with no space between the end bracket, colon and disabled.

Jamie Winspear
Jamie Winspear
4,321 Points

Thats got it, thanks. Do the spaces matter in "actual" coding?

Callum King
Callum King
6,470 Points

I'm certainly no expert, but I believe it depends on the type of selectors you are using, each have different rules for spacing.