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

More 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

@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.

Hi I have written this and it keeps telling me Im wrong a [title] { color:red; }

Guil Hernandez
Guil Hernandez
Treehouse Teacher

Hi Deirdre FReeman,

Just remove the space between the a and [ and you're all set. :)

Thanks Guil Hernandez

Thank you Guil!

I 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!

A quick reference guide is very helpful when learning about a new function. A really like the Sitepoint's one for CSS selectors

Thanks for the link JB, looks very helpful, did not know about that site!

There's also htmldog.com for all of your HTML & CSS property needs.

Guil Hernandez
STAFF
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.

Thanks 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!

Deleted User

Nope, not the only one @Michael. Same thing happened here.

It 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

What is the difference between the space and no space? I had this same error..

Jennifer Fry -

Spaces 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.

:D Thank you! I <3 you guys btw.

Had the same issue too. Thx for the post.

I made the same mistake with that space between the characters!