With or without

yooouuuuu padding + margin + borders. In other words how to adjust your box-model to include ‘em. But you already knew that didn’t didn’t you.

*, *:after, *:before {
    box-sizing: border-box;  /* or content-box or inherit */
    padding: 0;
    margin: 0;
}

So how about support:

Chrome (any): box-sizing
Opera 8.5+: box-sizing
Firefox : -moz-box-sizing (unprefixed since ??)
Safari 3: -webkit-box-sizing (unprefixed in 5.1+ versions)
IE8+: box-sizing

And then there’s padding-box which is just weird (inset/outset on borders!..) and FF only so you can forget that. And, one more thing, there’s the min/max-height thingy. But you can checkout this excellent jsFiddle on that.

One Response to With or without

  1. Jasper J. Jimenez says:

    To be fair, Internet Explorer has since begun to adhere to the standard box model. Old pages that used the old box model still work as such in “Quirks” mode, while new standards-compliant pages are rendered appropriately in “Standards” mode ( there’s an article on Quirks vs. Standards modes here ).

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>