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
Michael Duquet
4,703 PointsMore Selectors Code Challenge
Task #3 - "Use an Attribute Selector to select the <a> element with the 'title' attribute. Give it a color property with a value of red."
This question is driving me nuts. When I make the applicable change, it tells me that now Task #1 doesn't work.
I added title="#" to the HTML, then made the CSS
a[title] { color: red; }
What am I missing? The actual video doesn't say how to add a "title" attribute.
8 Answers
James Barnett
39,199 Points@Michael -
Are you still having an issue with this?
For reference these are the instructions:
Use an Attribute Selector to select the <a> element with the 'title' attribute. Give it a color property with a value of red.
Your CSS a[title] { color: red; } is correct, it does exactly that.
Note that the instructions make no mention of changing the HTML. Making unrequested changes to the HTML could cause the code challenge check to fail.
Bob Mahogan
1,994 PointsI also struggled with this. Primarily due to the fact that in the tutorial videos, he spoke of [class], so it threw me off that, evidently you are allowed [anything] inside the brackets. I realize that to experienced coders, this might be a no-brainer, but to noobs, we kinda take it literal as your only allowed [class] as a defining command, doh!
James Barnett
39,199 PointsA quick reference guide is very helpful when learning about a new function. A really like the Sitepoint's one for CSS selectors
Bob Mahogan
1,994 PointsThanks for the link JB, looks very helpful, did not know about that site!
James Barnett
39,199 PointsThere's also htmldog.com for all of your HTML & CSS property needs.
Guil Hernandez
Treehouse Teacher@Michael
Your CSS rule is correct – nice job! A title attribute has already been added to a link in the HTML file: <a href="#" title="foo">, so you don't need to add anything to the markup.
Michael Duquet
4,703 PointsThanks for the answer folks!
I couldn't see that I needed to scroll to get to the other tag with the title="foo", that's where I got confused/enraged. I was just looking at the one that was visible on screen, then I saw that I needed to scroll all the way over to find the second one. Alas, that worked.
I might be the only person dumb enough to have that issue, but I'd definitely suggest to make it "idiot proof", make it so that all the code doesn't need to be scrolled, to be seen.
Just my two cents,
Thanks again!
Nope, not the only one @Michael. Same thing happened here.
novice J
Courses Plus Student 2,551 PointsIt drove me nuts too for a while. I realized all I had to do was close the space between a and [ in order to get it right. Uuuurgh!
Thanks folks
Jennifer Fry
9,855 PointsWhat is the difference between the space and no space? I had this same error..
James Barnett
39,199 PointsSpaces are syntactically significant in CSS because they refer to descendant selectors. If you are still having issues create your own thread, with your code and link to code challenge you are having issues with.
Jennifer Fry
9,855 Points:D Thank you! I <3 you guys btw.
Ben Quirk
937 PointsHad the same issue too. Thx for the post.
Santiago Barrionuevo
14,176 PointsI made the same mistake with that space between the characters!
Deirdre Freeman
Courses Plus Student 5,802 PointsDeirdre Freeman
Courses Plus Student 5,802 PointsHi I have written this and it keeps telling me Im wrong a [title] { color:red; }
Guil Hernandez
Treehouse TeacherGuil Hernandez
Treehouse TeacherHi Deirdre FReeman,
Just remove the space between the
aand[and you're all set. :)Deirdre Freeman
Courses Plus Student 5,802 PointsDeirdre Freeman
Courses Plus Student 5,802 PointsThanks Guil Hernandez
Jerry Welch
3,818 PointsJerry Welch
3,818 PointsThank you Guil!