盒子模型

Youky ... 2023-5-9 前端
  • CSS
Less than 1 minute

# 盒子模型

# 标准盒子模型和 IE 盒子模型的区别

盒子模型中,宽度(高度同理)一共分为四部分:

  • content:内容宽度
  • padding:内边距
  • border:边框
  • margin:外边距

两种盒子模型的区别

  • 标准盒子模型中:width = content
  • IE 盒子模型中:width = content + padding + border

更改计算方法:box-sizing属性。

  • content-box:标准模型
  • border-box:IE 模型
  • inherit:继承父元素的取值
Last update: May 9, 2023 23:23
Contributors: Youky