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

help with width, height, overflow properties challenge,

I am stuck on task three of the box model challenge "width, height, and overflow" I do not know how to make the box-sizing to work. I can't get it to resize the box to a width of 400. Would anyone care to help me?

5 Answers

Steven Litton
Steven Litton
13,520 Points

If you add this line - box-sizing:border-box;

then add the amount of padding you need to apply.

Now the padding will be applied to the inside of the div and not the outside so the width will stay at 400px.

Hope that makes sense.

what am i doing wrong on task 3...here is what i have. .main div { width: 400px; padding: 20px; border: 2px solid; box-sizing: border-box; }

thanks for all the help steve, sorry just a bit slow to learn this.

Steven Litton
Steven Litton
13,520 Points

Check how you have factored your CSS selector, you will soon work it out.

thanks for helping me arrive at the answer, i figured it out like 3 days ago. Good man!