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

Prath M
Prath M
9,631 Points

How do I make .card the new positioning context for .logo?

I'm not sure what to do here. Isn't .card already the positioning context for logo?

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

.logo {
  position: absolute;
  top: -45px;
  left: 125px;
}
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>
Prath M
Prath M
9,631 Points

Figured it out!

style.css
.logo {
  position: absolute;
  top: -45px;
  left: 125px;
}

.card {
  position: relative;
}
Steven Parker
Steven Parker
229,732 Points

Perfect! :star2: Good job! Did you look at the preview and see what it did?

1 Answer

Steven Parker
Steven Parker
229,732 Points

No, the positioning context is the closest ancestor element that has explicit position, or the window itself is there isn't one.

:point_right: You need to give .card a position, but not one that would move it.

I'm betting you can figure it out with just that hint and no explicit spoiler, but post a comment if you need additional help.