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 CSS Foundations Selectors Basic Attribute Selectors

shareyourpeace
shareyourpeace
3,244 Points

I couldn't get this answer.Create an attribute selector that will target <a> elements with a title attribute.

I couldn't get the answer to this quiz question. Create an attribute selector that will target <a> elements with a title attribute. Add a color property with the value darkred.

And after trying many things, I was unable to find a button to view the correct answer nor was I able to proceed to the next question.

6 Answers

Hi, try this:

[title] { color: darkred; }

Hi there shareyourpeace,

i would like to see how you do it but as i remember from my previous lessons u should select your title attributes by using the command below:

[title] { color: darkred; }

[title] attribute selector should select all elements with title attribute within its rule. Hope that helps.

Wayne Priestley
Wayne Priestley
19,579 Points

Hi,

It's better to point someone in the right direction rather than giving them the out right answer as providing the answer does nothing for the learning process.

So with that said, your asked to target the <a> element with the title attribute, so don't forget to add that element to the above answers.

Hope this helps.

Wayne, good suggestion. Thx for advice

Wayne Priestley
Wayne Priestley
19,579 Points

No problem Pav,
Thanks for answering the post, a good explanation of the attribute selector.

shareyourpeace
shareyourpeace
3,244 Points

Thanks. I tried a few things but I did not have [title] within the square brackets. Going from memory....

In the html I added a class to title (although I don't think this is valid).

<title class="title">

In the css a[class="title"] { color:darkred; }

Wayne Priestley
Wayne Priestley
19,579 Points

No need to add the class or change your html, you have the answer correct if you just remove the class=" " and change the html back to how it was.

Paul Calabrese
Paul Calabrese
13,516 Points

I also had some trouble with this one and had to refer to this post to go forward.

Was this a trick question? I only ask because the way it was framed, to target <a> elements. Doesn't that suggest something that looks like "a[ ]," especially since there was no examples in the lesson (that I can remember at least) that ended up looking like the correct answer.

I may be over thinking this, but I'm just trying to get a better understanding here.

Wayne Priestley
Wayne Priestley
19,579 Points

Hi Paul,

I think your right, without a reference in the video they provided a big hint in the question.