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 trialmanjunath shenoy
790 Pointsneed help
I am not getting right answer to "Create a new rule using the selector that targets an element only if its ID matches the hash in a URL. Set the background color to tomato."
I tried with below, but both of them not work
a) *:[id="#"] { background-color:tomato }
// below i have used contains pseudoclass b) *:[id *="#"] { background-color:tomato }
Please let me know why is it not working.
4 Answers
Timothy Crandall
4,354 Points:target { background-color: tomato;}
Timothy Crandall
4,354 PointsThe question is worded kind of strange, keep in mind They want you to change the background color of the DIV the link selects, not the links background itself! ;)
Sorry for the crazy double post, the forums sometimes don't agree with what I am thinking... You should be able to delete an answer, or comment!!
Jeff Busch
19,287 PointsHi Timothy,
I guess I'm not really sure what "they" want. But I do know that while your code passes the code-challenge it turns nothing the color tomato. I even tried it in my own browser creating my own html and css files. Oh well.
Jeff
Timothy Crandall
4,354 PointsHey Jeff, Use that code then click the internal link on the page. You should be able to see what it does. Tim
Jeff Busch
19,287 PointsHi Manjunath,
The following code works, but doesn't pass. Timothy's code passes but didn't work for me.
Jeff
Hey @Guil Hernandez
/* Write your CSS code below */
html
{
background-color: lightblue;
}
a[href*="#"]
{
background-color: tomato;
}
Timothy Crandall
4,354 PointsKeep in mind The question is worded kind of strange. They want you to change the background color of the DIV that the link selects, not the link 's background itself