gpt4 book ai didi

css - W3C盒模型与IE5盒模型相比有什么优势?

转载 作者:技术小花猫 更新时间:2023-10-29 11:21:59 24 4
gpt4 key购买 nike

我觉得IE5的盒子模型更接近于人类对盒子概念的逻辑,包括padding和border。它可以直接定义盒子的宽度和高度。

In cases in which you have an element with a width of 100%, the IE5 box model allows you to add padding and borders safely. Compare this to the correct CSS box model, in which you cannot add any padding or borders to an element with a width of 100% without breaking the layout

所以谁能详细解释一下?W3C盒模型有什么优势?

谢谢

最佳答案

100% 示例有时是 W3C 框模型的一个有效问题,但它主要是一个有争议的问题,因为您可以使用以下代码并实现您所指的“IE 5 框模型”:

box-sizing: border-box;

/* probably not needed in 2016 */
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;

box-sizing 适用于所有主流浏览器 IE8+。我现在专门使用它;在我看来,微软在这一点上是正确的。

另见

关于css - W3C盒模型与IE5盒模型相比有什么优势?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4576955/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com