Bummer! You must be logged in to access this page.

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

z-index

I have been watching the z-index video and trying to follow along, for some reason mine won't work.

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
    <title>Positioning</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="wrapper">
        <div class="top">Top</div>
        <div class="middle">Middle</div>
        <div class="bottom">Bottom</div>
    </div>
</body>
</html>
body {
    margin: 70px 0 0;
    background: #E1E1DD;
    color: #FFF;
    font: normal 1.4em sans-serif;
}

.wrapper {
    box-sizing: border-box;
    margin: 0 auto;
    padding: 25px;
    width: 80%;
    background: #FFF;
    position:relative;
}

.top {
    background: #FF6347;
    position:relative;
    z-index:10;
}

.middle {
    background: #87CEEB;
    position:absolute;
    z-index:20;
    right:0;
    bottom:0;
}

.middle:after {
    position:absolute;
    bottom:0;
    left:0;
    width:50px;
    height:50px;
    background:#000;
    content:"";
}

.bottom {
    background: #20B2AA;
    position:relative;
    z-index:30;
}

.fixed {
    position:fixed;
    top:0;
    width:100%;
    height:60px;
    background:#000;
}

.wrapper div {
    width: 150px;
    height: 150px;
    text-align: center; 
    line-height: 150px;
    text-shadow: 0 1px 1px rgba(0, 0, 0, .5);
}

any help would be greatly appreciated.

3 Answers

for some reason the html didn't get copied right:

``

<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>Positioning</title> <link rel="stylesheet" href="style.css"> </head> <body> <div class="wrapper"> <div class="top">Top</div> <div class="middle">Middle</div> <div class="bottom">Bottom</div> </div> </body> </html>

``

<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>Positioning</title> <link rel="stylesheet" href="style.css"> </head> <body> <div class="wrapper"> <div class="top">Top</div> <div class="middle">Middle</div> <div class="bottom">Bottom</div> </div> </body> </html>

alright, i downloaded the 'finished' files and it all works now. Sorry for the confusion, i am still new to this.