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

why is the margin-top not working in lecture about the box model?

The CSS challenge about the box model says that you need to apply a margin-top of 50px. I fill in: margin-top: 50px;

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

What can be wong ?

1 Answer

Chris Shaw
Chris Shaw
26,676 Points

Hi Mark,

The reason it's failing is because you're referring all DIV instead of just elements with a class of .box, switch it to that like I have already done below and it will pass as expected.

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

Thanks!