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

Taokeen Cheung
Taokeen Cheung
10,606 Points

#col-c:target {background: #eff1f2;} - Not changing. How do I fix?

Hi everyone.

So I followed this tutorial on workspaces precisely as Guil wrote it out:

:root {
  background: #e3effb; 
}

:target {
  background: #384047;
  color: white;
}

#col-c:target {
  background: #eff1f2;
  color: initial;
  box-shadow: 0 0 6px rgba(0,0,0, .2);
}

However for some reason #col-target background colour does not change to #eff1f2.

When I look into developer tools on Chrome it displays: invalid property value. I was just wondering whats going on? So I can learn to fix a similar issues in future?

2 Answers

Andrew Wong
seal-mask
.a{fill-rule:evenodd;}techdegree
Andrew Wong
Full Stack JavaScript Techdegree Student 15,373 Points

Is there possibly a syntax error? In your "background: #eff1f2;" code, I right-clicked the space between the colon and the # symbol, and it gave me <span class="err"></span>

Hi there,

Not 100% sure but I think it should be #col-c a:target { } as you can't actually target the ID. Also it will only change colour when targeted, so try hitting tab a few times.

Regards,