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 Selectors Advanced Selectors :root and :target

YOUSSEF D
PLUS
YOUSSEF D
Courses Plus Student 3,778 Points

:target for hidden and show div

Why I cannot setting

col-c:target {

display: normal;

}

after

col-c {

display: none;

}

?

2 Answers

Christina Giannouli
Christina Giannouli
18,202 Points

I am not sure I have understood what exactly it is that you're asking but if I got this right you need to specify the element's id (with a pound sign) before the pseudo selector. In your case, you have to do this:

#col-c:target { display: none; }

Also, as far as I know the "normal" is not a valid value for the "display" css property. You can check here (MDN) for the full list of property's values.

YOUSSEF D
YOUSSEF D
Courses Plus Student 3,778 Points

I mean how to show and hide the div by that .

You can do this:

#col-c {
  display: none;
}

#col-c:target {
  display: initial;
}

And then Column C will only be shown when targeted. Since :target has greater specificity, the ordering does not seem to matter.