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

Oziel Perez
Oziel Perez
61,321 Points

Challenge Task 3 Not working

the third task in this challenge says I have to add a top margin of 50px. So I did using margin-top:50px; after I click check work, the program says it's wrong. I don't get how is it wrong if I know it's correct. Unless, I'm missing something here, the program is not reading this correctly...

Oziel Perez
Oziel Perez
61,321 Points

....Nevermind, I fixed it. The browser, apparently, only read the margin-top:50px statement so long as it was for the class ".box" selector and not for the div selector. I don't get why it has to be exactly like that. Oh and Dustin i just saw your comment. Yeah that's what I meant, I redid the code using the ".box" class selector. I wonder why wouldn't it work the same for the div selector. It's rather strange.

Oziel Perez
Oziel Perez
61,321 Points

....Nevermind, I fixed it. The browser, apparently, only read the margin-top:50px statement so long as it was for the class ".box" selector and not for the div selector. I don't get why it has to be exactly like that. Oh and Dustin i just saw your comment. Yeah that's what I meant, I redid the code using the ".box" class selector. I wonder why wouldn't it work the same for the div selector. It's rather strange.

Generally I think you can code it as below but perhaps the challenge engine isn't setup for that. It can also cause an issue down the road if you are too specific when using selectors but sometimes it may be necessary.

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

1 Answer

You might have to save your code to a clipboard and refresh the page. If not check if all brackets and semi(colons) are closed and all previous code is correct.

The code block should look something like this.

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