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 trialMUZ140067 Precious Mutangi
13,064 PointsSTAGE 2 CHALLENGE 1
Create an attribute selector that will target <a> elements with a title attribute. Add a color property with the value darkred.
<!DOCTYPE html>
<html>
<head>
<title>Attribute Selectors</title>
<link rel="stylesheet" href="page.css">
<link rel="stylesheet" href="style.css">
</head>
<body>
<form class="e-form">
<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 */
[class] {
background-color:crimson;
color:darkred;
padding:5px;
}
1 Answer
bleedcmyk
5,945 Pointsin your CSS you need to make sure you target link elements with a title attribute so you want your css to be something like;
a[title] {
color: darkred;
}
the 'a' will target <a> link elements and the [title] makes sure that only link elements with a title attribute get targeted.
changing [class] in your CSS stylesheet to a[title] should do the trick.