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 trialvandevski
20,617 Points[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
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.
vandevski
20,617 PointsLast part .sticky seems correct to me?
vandevski
20,617 Points@Brandon
That did it. Thank you so much!
Brandon Escalante
5,772 Points@Andrew Awesome! I remember having the same problem and staring at it for a while. Glad I could help!