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 Layout Basics Positioning Page Content CSS Positioning Challenge

Ran Pur
Ran Pur
536 Points

I am confused by the question.

I am unclear on exactly what I need to do here. I do not understand the question.

style.css
/* Complete the challenge by writing CSS below */

.logo {
    position:absolute;
  top: -45px;
  left: 125px;
}
.card{
position:absolute;
}
index.html
<!DOCTYPE html>
<html>
<head>
    <title>CSS Positioning</title>
    <link href='https://fonts.googleapis.com/css?family=Varela+Round' rel='stylesheet' type='text/css'>
    <link rel="stylesheet" href="page.css">
    <link rel="stylesheet" href="style.css">
</head>
    <body>
        <div class="card">
            <img class="logo" src="city-logo.svg" alt="logo">
            <h2>Best City Guide</h2>
            <p>Cheesecake oat cake marshmallow. Bonbon pastry apple pie danish donut bonbon marshmallow caramels. Bear claw chocolate bar lemon drops. Carrot cake jelly beans jelly beans pie.</p>
        </div>
    </body>
</html>

2 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Hi Ran, let me go through each of the steps with you, as there are 3 in the code challenge.

First, you need to select the element with the class of logo and give it absolutely positioning, which you've done.

Secondly, you set your position offsets from left and the top, which you've also done.

Where you've done wrong is you've set .card to also have absolute positioning. In order to set the context for .logo, you need to give .logo relative positioning. What this means is .logo will be set to move within .card and not the root element.

Ran Pur
Ran Pur
536 Points

Thank you. I took a break when I got stuck and reread the instructions after reading your post and it clicked. It even says "relative" in the directions. Just me overlooking the small details. Thank you for the fast response and helping me.

the parent element with class .card have to be relative so that your .logo has something to relative to (otherwise it will pick the body element)