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 Foundations The Box Model The CSS Box Model Concept

Johnny Whitfield
Johnny Whitfield
14,024 Points

Why won't this approve my 50px top margin? I've set it as margin-top: 50px; and margin: 50px 0; but neither work.

div { margin-top: 50px; padding: 20px 40px; border-width: 5px; border-style: solid; }

index.html
<!DOCTYPE html>
<html>
<head>
    <title>Box Model Concept</title>
    <link rel="stylesheet" href="page.css">
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="box">
        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
        tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
        quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
        consequat.
    </div>
</body>
</html>
style.css
/* Complete the challenge by writing CSS below */
div {
  margin-top: 50px;
  padding: 20px 40px;
  border-width: 5px;
  border-style: solid;
}

2 Answers

Kelly von Borstel
Kelly von Borstel
28,880 Points

I'm not sure why your code doesn't work, but the following worked for me. I used the class name .box as the selector instead of div. And I used shorthand for border property.

.box {
  padding: 20px 40px; 
  border: 5px solid;
  margin-top: 50px;
}