Why isn't there a padding
I was playing with the box model today and changing the box-sizing to see the results. As we all know, a value of content-box is the default. That means that when we declare a width for an element it considers the width to apply to the content only, therefore the padding and border are going to increase the TOTAL size of the element. Then we can use the value of border-box which tells the browser that you must consider the border width AND the padding width when we declare the width of the content.
My question is, why isn't there a "padding-box" so that it includes the padding as part of the width declaration, but NOT the border? Not sure why I would do this, but for academic reasons I would like to know why it does not exist.
There was in fact one, and it was implemented by Mozilla in -moz-box-sizing
. But it was dropped from the spec after spending several years in limbo (and it would seem that all references to it have been removed from MDN as well) as there was neither author nor implementer interest, which means there weren't enough practical use cases to justify the feature.
上一篇: CSS3 Flexbox:显示:box与flexbox vs. flex
下一篇: 为什么没有填充