盒子模型的元素包括contentpaddingborder以及margin
而W3C标准盒子模型与IE盒子模型的区别主要在height和width所涵盖的元素上。

W3C标准盒子模型的height和width指得是content的height和width

box height = content height
box width = content width

而IE盒子模型的height与width包含了content, padding以及border

box height = content height + padding-top + border-top + padding-bottom + border-bottom

box width = content width + padding-left + border-left + padding-right + border-right

[CSS] W3C标准盒子模型(box model)与IE盒子模型

如果加入<!DOCTYPE>的话,浏览器则会根据W3C的box model来布局。

相关文章:

猜你喜欢
相关资源
相似解决方案