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
Pseudo-class help [Resolved]
Hey guys, I hope you are great.
I have a quick question. I just took the 'More Pseudo-classes' challenge and even when I got this answer correct I feel that I'm missing something.
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 the HEX value EA2E49.
This is the code I have used:
Jason Hess4,789 Points
The question is bit of a trick question If you read the question carefully, it's actually very simple, they do try to trick you up in throwing in the whole "url" thing.
All they are asking is "Create a new selector(the psuedo-class you just watched in the video) that "targets" an element that has a # "hash" in its url. and set the background color to whatever HEX value. They are not telling you to target the hash, but just to create the selector that would target the element. Try not to beat yourself up over these questions. You're just going to get frustrated and not sign back in for a few weeks. The forum is there for you to get assistance.
Get the "jsFiddle" example perfectly. Don't know how to pass this step of the challenge. Also, able to make it work in CodePen....don't know what's up with that.
/* Just to note the above concern was never answered */
I was able to figure this out though; after I left it alone for 2 weeks and came back. The question should be worded like this.
"Create a new selector that "targets" an element that has a # "hash" in its url. and set the background color to whatever HEX value".....This doesn't give me everything, but I can see that I need to find a url that has a # in it. From there I can see if what I'm looking for is a Class or an ID that references said url.
It's confusing because it sounds like you're asking me to find an ID with a # in it. After reading it a million times I figured out you wanted me to match an ID (which is unknown) to the "section" it references on the page.
I've never used this myself, but the way I understand it is that the CSS rule using :target will apply or "match" whenever the hash in a URL matches a corresponding ID value of an element on the page.
I feel I'm missing more lines in the code I submitted. I don't see any ID matching the hash in a url on my code. The video is perfect maybe is just that I didn't understand the challenge very well. Maybe I need something before ":target", but again, I'm not sure.
Awesome! Thanks so much for your help Guil and Sam!
Joseph: Refresh the page and do the challenge again. The first rule you tried will work. I believe the code on the site was just having an issue.
I am having trouble with this too. The question is now: "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."
So far I've tried: