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 trialAndrew Bytheway
3,131 PointsCode Challenge: Additional Pseudo Classes
OK, I've been stuck on this for quite a bit. I was using my friend's subscription to test out teamtreehouse and I loved it, so I got my own. Unfortunately, I had to skip to the end of the videos to mark that they had been viewed, and do the quizzes and code challenges over again to remake up the progress I had made on my friend's account. So I've done this code challenge before, but I'm stuck:
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'.
[id="#"] { background-color: tomato; }
2 Answers
Thomas MacFarlane
2,430 PointsIf you wanted to post the solution here and then select your answer as "Best Answer", that would neatly archive this discussion :)
Happy to have you at Treehouse!
Marshall Hendrickson
12,458 PointsAny way to delete a forum topic?
Thomas MacFarlane
2,430 PointsPossibly, but I wouldn't recommend it. Far better to archive it so if anyone else makes a similar mistake they can find the answer in the forum.
James Barnett
39,199 PointsAny way to delete a forum topic?
Anyone with moderator
or staff
below their name has the power to delete a forum topic. You can summon one to such a thread by @ tagging their name.
Possibly, but I wouldn't recommend it. Far better to archive it so if anyone else makes a similar mistake they can find the answer in the forum.
I concur.
Benjamin Gregory
5,015 Pointswell, I tried :target[id*="#"]{ background-color: tomato;} and got bupkis.
Thomas MacFarlane
2,430 PointsBenjamin, I suggest you re-watch the video and copy what Guil does.
Cindy Lam
1,785 PointsThe question is awkwardly phrased... Since all the IDs have the same name, you can just input:
:target { background-color:tomato }
As an aside... I really love Treehouse, your UX is definitely top-notch. However, when trouble shooting code, it is a very slow process. I hope there will be a better way (perhaps like codeacademy) where you can see the answer if you're really stuck.
James Barnett
39,199 PointsCindy Lam where you can see the answer if you're really stuck.
I don't think giving away the answer does the learner any favors. Programming is similar to math if you get the answer to the problem and don't understand why that answer is correct then you will be confused later on.
Here's a great article about this struggle-based approach Teaching Programming to the Highly Motivated Beginner
In general my view is that a large part of liking coding is enjoying spending the better part of a day hunting for a misplaced semicolon.
I've learned a lot of valuable information from doing something wrong and learning how to fix it. Parsing directions, spotting errors in the instructions as well as typos in your own code are all valuable real-world skills that I use every day, as is puzzling out how something is currently setup when you have no documentation telling you how things are supposed to work.
Cindy Lam
1,785 PointsThanks for the response James. I never thought anyone would read it, so you can imagine my surprise at seeing a well-thought out and articulated response.
I agree with you but you walk a fine line when using struggle-based approach. For example, I'm learning Chinese right now. I always remember the words where I have to physically use a dictionary to find.However, having an online dictionary is still useful. Similarly, most people prefer googling to going to my library to find information. It's a trade off between time and knowledge.
For problem solving, this can be a worthwhile technique, especially if the problems are similar to what we would want to do in real life ( I.E. - make the title stand out more vs change the title to font size 36 pt).
All in all, I would still love to see some quick and easy to find answers. (oh god... that sounds terrible)
James Barnett
39,199 PointsAll in all, I would still love to see some quick and easy to find answers.
That's what syntax references are for.
- HTML Dog
- Sitepoint Reference
- devdocs.io
Of course in the real world not all questions have quick and easy answers. If programming were easy Front End Devs wouldn't get paid so well
Of course there's a lot of you can do to help yourself out.
- Syntax highlighting in your text editor
- CSS Lint
- Creating a reduced test case
- Rubber duck debugging
virginiachubo3
8,963 Points:target{ color:white background-color:tomato; } it worked for me
Andrew Bytheway
3,131 PointsAndrew Bytheway
3,131 PointsI got it, nevermind, but thanks!