简体   繁体   English

与IE5机箱型号相比,W3C机箱型号有什么优势?

[英]What is the advantage of W3C box model compared with IE5 box model?

I think the IE5 box model is more similar to human's logic about box's concept,withing including padding and border.It can defined the box width and height directly. 我认为IE5盒子模型更像人类关于盒子概念的逻辑,包括填充和边框。它可以直接定义盒子的宽度和高度。

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. 如果您有一个宽度为100%的元素,IE5盒子模型允许您安全地添加填充和边框。 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 将此与正确的CSS框模型进行比较,在该模型中,您无法在不破坏布局的情况下向宽度为100%的元素添加任何填充或边框

So any one could explain it in details?What is the W3C box model advantages? 那么任何人都可以详细解释一下吗?W3C盒子模型的优势是什么?

Thank you 谢谢

The 100% example is sometimes a valid issue with the W3C box model, however it is mostly a moot point because you can use the following code and achieve what you are referring to as the "IE 5 box model": 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 is available in all major browsers IE8+. 所有主流浏览器IE8 +都提供了box-sizing I use it exclusively now; 我现在专门用它; Microsoft had this one right, in my opinion. 在我看来,微软有这个权利。

Also See 另见

The primary advantage of adopting the W3C box model is that the IE5 box model adoption rate is dwindling, to say the least. 采用W3C盒子模型的主要优点是IE5盒子模型的采用率正在减少,至少可以说。 Most people should consider IE6 outdated, never mind IE5. 大多数人应该考虑IE6过时,更不用说IE5了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM