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 Advanced Selectors Pseudo-Elements: ::before and ::after

Sean Flanagan
Sean Flanagan
33,235 Points

Download icon won't appear

Hi guys and girls.

The download icon won't appear before the text. How do I make it appear please?

Here's my HTML:

<!DOCTYPE html>
<html>
<head>
    <title>Pseudo-Elements</title>
    <link rel="stylesheet" href="css/css_foundations_style.css">
</head>
<body>
    <p class="phone">555-867-5309</p>
    <a class="dload" href="examples.pdf" title="- PDF">Download File</a>

    <div class="box">Generated Shapes</div>
</body>
</html>

And my CSS:

body {
    padding: 1% 26.5%;
    background-color: #e0eef5;
    color: #333;
}

p, div {
    margin: 55px 0;
    font: 3em sans-serif;
}

a {
    color: royalblue;
    text-decoration: none;
    font: 2.25em sans-serif;
}

/* Pseudo-elements */

.phone::after {
    content: "\2706";
}

.dload:: before {
    margin: 0 8px;
    content: url(http://treehouse-code-samples.s3.amazonaws.com/CSS-DD/codepen/stage-3/pdf-lg.png);
}

.dload::after {
    content: attr(title);
    padding-left: 10px;
    font-size: .75em;
    color: tomato;
}

.box::before, .box::after {
    content: "";
    display: inline-block;
    width: 30px;
    height: 30px;
    background: royalblue;
    border-radius: 50%;
    margin: 15px 15px 0 15px;
}

.box {
    border: 1px solid;
    padding: 10px;
}

Thanks.

1 Answer

It looks like you might have a space in the selector in your CSS file, if you try updating it without that space, does it work?

.dload::before {
    margin: 0 8px;
    content: url(http://treehouse-code-samples.s3.amazonaws.com/CSS-DD/codepen/stage-3/pdf-lg.png);
}