Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

Lindsay Barrett
seal-mask
.a{fill-rule:evenodd;}techdegree
Lindsay Barrett
Python Web Development Techdegree Student 7,357 Points

attribute 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

because 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
seal-mask
PLUS
.a{fill-rule:evenodd;}techdegree seal-36
Brent Suggs
Front End Web Development Techdegree Graduate 21,343 Points

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