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) The Box Model Borders

Jordan C
Jordan C
6,249 Points

Do you recommend using border-box or content-box?

and is one better for a responsive web design?

Amrit Pandey
Amrit Pandey
17,595 Points

Content Box is by-default the value for initial boxes(elements) on the page. We use Border-box so that we can have same width and height and width of boxes despite the change in padding and margins. Mostly, we use Border-box when we reset the whole page. It's only matter of need, if you need content box we use that, if we need border box we use that.

1 Answer

Steven Parker
Steven Parker
231,248 Points

It depends on what you are doing.

If you're primarily concerned with content dimensions, the default value of content-box is fine. But when your concern is exterior dimensions, it may be more convenient to use border-box instead.

Good designs can be created by proper applications of either setting.