开发者

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.

In cases in which you have an element with a width of 100%, the IE5 box model al开发者_如何学运维lows 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

So any one could explain it in details?What is the W3C box model advantages?

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":

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+. I use it exclusively now; Microsoft had this one right, in my opinion.

Also See

  • Why is the W3C box model considered better?


The primary advantage of adopting the W3C box model is that the IE5 box model adoption rate is dwindling, to say the least. Most people should consider IE6 outdated, never mind IE5.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜