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 Width, Height and Overflow Properties

Marcelo Pasos
Marcelo Pasos
2,019 Points

Currently, the width of the div with the class main is set to 400px, but the padding applied is adding an extra 40 pixel

Currently, the width of the div with the class main is set to 400px, but the padding applied is adding an extra 40 pixels to its total width. Add a property that forces the padding into the width of the div.

Hi Marcelo,

Can we see your code?

3 Answers

Markus Ylisiurunen
Markus Ylisiurunen
15,034 Points

Hi!

You should add a box-sizing: border-box to the div with a class "main".

Your code should look like this:

div.main {
    box-sizing: border-box;
}
Marcelo Pasos
Marcelo Pasos
2,019 Points

.main { max-width: 360px; padding: 20px; }

Markus has supplied you with the answer. Here is the complete code for the challenge, I think.

nav a {
  display: inline-block;
  width: 100px;
}

.main {
  box-sizing: border-box;
  max-height: 150px;
  overflow: auto;
}

Also, if you look just below the text box area you will see something that says Markdown Cheetsheet. Also, there is a post here titled: Posting Code to the Forum by Dave McFarland. If you don't understand that maybe this will make sense: How to display code at Treehouse.

Jeff