Posted By

kawohi on 09/18/10


Tagged

css


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

jplr
baczoni


box-sizing; The way the box model is suppose to be!


 / Published in: CSS
 

The box-model we have now is weird. When we add padding and borders to our elements, it's added to the width and height so they are larger then the width and height we set them to be. With this snippet (Added in CSS3). The box-model is now in our control and the padding and borders are subtracted from the elements.

This is such a good snippet that I even added it to my reset style sheet.

  1. .box-sizing {
  2. -moz-box-sizing: border-box;
  3. -webkit-box-sizing: border-box;
  4. -ms-box-sizing: border-box;
  5. box-sizing: border-box;
  6. }

Report this snippet  

You need to login to post a comment.