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 Values and Units Color Values

Craig Curtis
Craig Curtis
19,985 Points

I'm trying to figure out how Guil got the text behind the div. Couldn't find it in the CodePen example.

div {

/*  
    -- Predefined Keyword Examples -- 

    background-color: red;
    background-color: green;
    background-color: blue;
    background-color: lightblue;
    background-color: tomato;
    background-color: sandybrown;
*/

/*  
    -- Hexadecimal Examples -- 

    background-color: #FF0033;

*/

/*  
    -- RGBa Example -- 

    background-color: rgba(65,105,255, .9);

*/

/*  -- HSLa Example --  */

    background-color: hsla(130,50%,35%,.1); 

}

1 Answer

Henrik Videberger
Henrik Videberger
8,202 Points

He's using z-index:-1 in the div:after where the text is located.

Checkout the gear icon next to HTML in codepen, you'll see

stuff for head

<style>
body {
    font-size: 1.2em;
    font-family: 'Open Sans', sans-serif;
    width: 80%;
    margin: 0 auto;
}

div {
    height: 25em;
    margin-top: 2em;
    position: relative;
        text-align: center;
}

div:after {
    content: "I'm behind the div!";
    font-size: 2em;
    position: absolute;
    top: 40%;
    left: 35%;
    z-index: -1;
}
</style>