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 trialLouis Delgado
10,182 Pointsa [target="title"] { color: darkred; } is this wrong??
I'm trying to figure out what is wrong with my attribute selector what am I doing wrong?
<!DOCTYPE html>
<html>
<head>
<title>Attribute Selectors</title>
<link rel="stylesheet" href="page.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus sed egestas tortor, vel tincidunt dolor.
</p>
<a href="#" title="More!">Duis ut velit faucibus</a>
<p>
Proin orci arcu, dapibus vel faucibus in, commodo in nunc. <a href="#">Vestibulum erat dolor laoreet</a> nec cursus non, luctus ut elit. In sed congue lectus, id ullamcorper massa. <a href="#" title="More!">View more »</a>
</p>
<form>
<input type="text" name="email">
<input type="submit" name="submit">
</form>
</body>
</html>
/* Complete the challenge by writing CSS below */
a [target="title"] {
color: dark red;
}
4 Answers
mikes02
Courses Plus Student 16,968 PointsI haven't done this particular challenge but are you trying to style the link based on what's contained in the title attribute? If so, you should be using the following:
a[title~="More!"] {
color: DarkRed;
}
The [attribute~=value] selector is used to select elements with an attribute value containing a specified word.
Stone Preston
42,016 Pointsremove the space between the element and the starting bracket and your dark red probably needs to be darkred:
a[target="title"] {
color: darkred;
}
Louis Delgado
10,182 Pointsa[target="title"] { color: darkred; }
it didn't accept it
Stone Preston
42,016 Pointssee mikes answer for why your target="title" is incorrect
Louis Delgado
10,182 PointsThanks for everyone's help, greatly appreciated!
Louis Delgado
10,182 PointsLouis Delgado
10,182 Pointsmy instructions where as follows:
Create an attribute selector that will target <a> elements with a title attribute. Add a color property with the value darkred.
I didnt think I had to specify a word?
mikes02
Courses Plus Student 16,968 Pointsmikes02
Courses Plus Student 16,968 PointsLouis, if that's the case, and you just want to select all links that have a title attribute, you can do the following:
Louis Delgado
10,182 PointsLouis Delgado
10,182 Pointsbut thats what I thought I had!! ahhhhhh!!! curse you Poseidon!! ... Thanks mike