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

[Code challenge] CSS Foundations>Framework foundations>CSS mastery

Hi guys,

I'm stuck on the last task of CSS foundations (first edition)>Framework foundations>CSS mastery.

Question: Using CSS, set the sticky class to be absolutely positioned 5px from the right of the document and 5px from the top of the document.

/***************** HTML***********************************************************************/

<!DOCTYPE html> <html lang="en"> <head> <title> My Page</title> <link rel="stylesheet" type="text/css" media="screen" href="style.css" /> <!-- Hint: You can edit style.css from the CSS Tab --> </head>

<div id="wrapper">

      <div id="content">
        <h1 id="title">Title</h1>
       <span class="sticky">I'm sticky</span>
      </div>
    </div>

<body>

</body> </html>

/***************** CSS ***********************************************************************/

wrapper {

line-height: 32px;

}

content {

background-color: white;
    margin: 20px;
    padding: 10px;
    border: 2px solid black;

}

h1 { float: left; }

.sticky { position: absolute; margin-right: 5px; margin-top: 5px;
}

Here's the codepen link: http://cdpn.io/jkgJm

Andrew

4 Answers

Brandon Escalante
Brandon Escalante
5,772 Points

@Andrew your problem is with margin-right and margin-top it's asking for right and top.

Try this: position: absolute; right: 5px; top: 5px; in your .sticky class.

Last part .sticky seems correct to me?

@Brandon

That did it. Thank you so much!

Brandon Escalante
Brandon Escalante
5,772 Points

@Andrew Awesome! I remember having the same problem and staring at it for a while. Glad I could help!