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 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
So any one could explain it in details?What is the W3C box model advantages?
Thank you
Quite simply, the CSS Box Model provides a guide to layout those elements. The CSS Box Model is used to create a definition for the way the HTML elements are organized on the screen. This approach accounts for options such as margins, padding, borders, and all the properties that manipulate them.
In the content box model, the content inside of element will have the same dimension as the element. In the border box model, the content's dimension has to subtract the border and padding from the element's dimension.
border-box and content-box are the two different values of box-sizing. content-box: This is the default value of box-sizing. The dimension of element only includes 'height' and 'width' and does not include 'border' and 'padding' given to element. Padding and Border take space outside the element.
The box-sizing property allows us to include the padding and border in an element's total width and height. If you set box-sizing: border-box; on an element, padding and border are included in the width and height: Both divs are the same size now! Hooray!
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With