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!
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

Lawrence Lee
4,240 PointsCode Challenge: width height and property
Hi,
So I am kind of stuck at step 3, and here is the question:
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.
I use div as my selector and I typed padding as 40px. I apply this code as the following: box-sizing: border-box;
Then It tells me that my box-sizing property is wrong? Did I reverse something?

Sayyad Bacchus
2,118 PointsLawrence, I know you ended up figuring it out, but could you post the answer anyways? I am currently having difficulties with this one as well and others may have the same problem in the future.
Thanks!
3 Answers

Sayyad Bacchus
2,118 PointsHere is the answer, in case anyone else is having difficulties:
div {
width: 400px;
box-sizing: border-box;
}

Guil Hernandez
Treehouse TeacherGlad you figured it out, Lawrence Lee! :)

Lawrence Lee
4,240 PointsThank you Guil!
By the way, I do have bit of problem with understanding relative and absolute positioning. I know absolute positioning is assign on first position of the ancestor element. Than relative element sets to its normal position. But I do not quite understand how these boxes are stacking on top of each other in a certain arrangement with combination of relative and absolute positioning pseduo element. Could you explain more?
Thanks!

Paul Kirsch
2,894 Points/I used this and it worked/
.main { box-sizing: border-box; }
Lawrence Lee
4,240 PointsLawrence Lee
4,240 PointsNever mind, I figured it out!