|
|
|
|
|
by JimDabell
1664 days ago
|
|
> I think it's absurd that I can set a div to a specific width (100px, 200px, whatever) and the padding or border will make the div larger than that width. That’s not what’s happening. Imagine you have a physical box. The contents are 10cm wide. There is padding of 2cm on each side. And the space around the box is 3cm. How wide is the box? It’s not 10cm; it’s 14cm. When you say: > I can set a div to a specific width …you aren’t setting the width of the div, you are setting the width of its contents. That’s why the property value is box-sizing: content-box – because you are setting the width of the content. If you’re setting the width of the content when you mean to set the width of the box, then no wonder it’s not doing what you want. |
|
How big is the box? I think most would measure from border to border. I think it’s easier to think of CSS in that way.