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 Basics (2014) Basic Layout box-sizing and max-width

Box sizing

does it make sense to apply box-sizing:border-box; to the Body or to Wrapping div like container and then will apply to entire page?

or is it better to apply it per element?

Garrett Sanderson
Garrett Sanderson
12,735 Points

Hi Itig,

It really depends on what you are trying to accomplish. Can you give an example of what you are trying to do?

2 Answers

Kristoffer Lund
Kristoffer Lund
11,133 Points

I actually watched the video yesterday. Guil applied it to the universal selector ( * ), so it applys to all divs. If you do it like that, it will be applied to all divs and you dont have to worry about doing math every time you are adding some padding.

Christopher Andrew Kemur
Christopher Andrew Kemur
7,709 Points

if you applied to the body, the child elements of the body will be apply the border-box property. In the video guil apply in the universal selector so the border-box will be applied in the all elements.