box-sizing
介绍
box-sizing 决定元件的 width、height、min-width、min-height、max-width、max-height 如何解析。
使用示例
语法
取值
-
border-box默认值。
width和height属性包括内容 (content),内边距(padding),和边框(border),但不包括外边距(margin)。尺寸计算公式:
width = border + padding + content
height = border + padding + content
-
content-box标准盒子模型。
width和height只包括内容 (content),不包括边框(border),内边距(padding),外边距(margin)。尺寸计算公式:
width = content
height = content
形式定义
| 初始值 | border-box |
| 适用元素 | 所有元件 |
| 是否支持继承 | 否 |
| 是否支持动画 | 否 |
形式语法
与 Web 的区别
- Lynx 的默认值为
border-box,Web 的默认值为content-box。 box-sizing不会影响flex-basis的取值。
兼容性
LCD tables only load in the browser
