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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Lindsay Barrett](https://secure.gravatar.com/avatar/ff0a6180bc070118edf41b4edc578221?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Lindsay Barrett
Python Web Development Techdegree Student 7,357 Pointsattribute styling
I have added an attributes css styling to my code, but the content image is not displaying in front of the html element.
<div class="footer4">
<h2>Get in Touch</h2>
<p class="phone">(623) 340-1422</p>
<p class="email">Aaabar@cox.net</p>
</div>
.email:: before {
content: url(images/get in touch/email.png);
margin-right: 8px;
}
2 Answers
![Fynn Lehnert](https://secure.gravatar.com/avatar/b6a1539b7a10fd66a4e537f4cd148edd?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Fynn Lehnert
15,244 Pointsbecause you left a space in front of the before
. and you need to define the content
as empty string ''
, then give it a height
and width
and then define a background-image
.
.email {
padding-left: 8px;
}
.email:before {
content: '';
background-image: url(images/get in touch/email.png);
height: 8px;
width: 8px;
}
![Brent Suggs](https://secure.gravatar.com/avatar/cae19131639d469934a1358f97c30767?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Brent Suggs
Front End Web Development Techdegree Graduate 21,343 PointsI would also like to add that you aren't really styling based on attribute as you are using a class.
To use attribule styleing so that every link with said attribute is treated the same you would do the following...
<div class="footer4">
<h2>Get in Touch</h2>
<a href="tel:6233401422">(623) 340-1422</a>
<a href="mailto:aaabar@cox.net">Aaabar@cox.net</a>
</div>
a[href^="mailto:"]::before {
content: url(images/get in touch/email.png);
margin-right: 8px;
}
This way any link with an href that starts with "mailto:" will get this styling.
![Lindsay Barrett](https://secure.gravatar.com/avatar/ff0a6180bc070118edf41b4edc578221?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Lindsay Barrett
Python Web Development Techdegree Student 7,357 PointsI understand your code but it is not working for some reason.