CSS3 box-sizing: margin-box; Why not?

后端 未结 9 1503
心在旅途
心在旅途 2020-12-04 11:39

Why don\'t we have box-sizing: margin-box;? Usually when we put box-sizing: border-box; in our style sheets we really mean the former.


9条回答
  •  佛祖请我去吃肉
    2020-12-04 12:19

    I think we could have a box-sizing: margin-box. The css box model shows exactly, what are the positions of the margins of the frames.

    There are minor problems - for example, the margin boxes can overlap - but they aren't hard to solve.

    I think, the situation is the same, as we can see with the overflow-x & overflow-y combinations, with the absolut positionied divs in table-cells, with the combination of min|max-width|height with the box-sizing, and so on.

    There are features, really simple features, which the browser developers simply doesn't develop.

    IMHO, box-sizing: margin-box were a very useful feature. Another useful feature were the box-sizing: padding-box, it exists at least in the standard, but it wasn't implemented in any of the major browsers. Not even in the newest chrome!


    Note: @Oriol 's comment: Firefox did implement box-sizing: padding-box. But others didn't, and it was removed from the spec. Firefox will remove it in version 50. Sad.

提交回复
热议问题