之前只是知道box-sizing设置成border-box,那么布局的时候,元素的宽高就是我们设置的宽高,省心方便。
今天仔细看了下 box-sizing的定义,有了新的认识
The
box-sizingCSS property sets how the total width and height of an element is calculated.摘自:https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
定义很准确:box-sizing决定了元素在屏幕上占的总宽高如何被计算
content-box
border-box