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

Christer Nordbø
Christer Nordbø
2,133 Points

[issue] Advanced Selectors -> More Pseudo-classes

Im having a struggle with the Codechallenge on this video.

Task:

The 'Phone' field in this form has been disabled in the HTML file. Create a new rule that selects the disabled field only, then set its background color to lightgray.

In the video you are using

:disabled { ...... } 

To select the disabled field. But when i try to do this is the Codechallenge it doesnt work.

my code:

:disabled {
  background-color: lightgray;
}

Whats the problem with this code?

[Solved] Removed the space after the :disabled and the { and it worked. I believe you should check some of the codechallenges for these "errors" as its not wrong code to have a space between a selector and the open curly bracked. specially since its allowed in most of the tasks.

1 Answer

James Barnett
James Barnett
39,199 Points

This code worked fine for me ...

:disabled {
  background-color: lightgray;
}

You probably made a typo and corrected it without realizing it.