Many web designers love to use frameworks, such as the popular 960 Grid System. These tools make our lives easier by taking care of the layout mark up, allowing us to focus on other more important aspects. Sure frameworks have their perks, but there just some problems that cause us to pull our hair out.
If you’ve ever used a framework for your website layouts, you notice everything is laid out pixel perfect. This, of course, is supposed to be great. But this also cause issues when we try to style everything. Have you ever tried to add padding or a border and your entire design changes? This is because you are overstepping the boundaries set by the framework. Even if its a simple 1px border on the right, this will drastically change your layout. There’s an easy fix to this problem which actually originated from a problem in Internet Explorer (Who knew an actual use could come out of IE?!?). It even works on just about every browser out there!
This simple trick is called Box-Sizing: Border-Box. Box-Sizing simply states that the width of the box will remain the same, while Border-Box stated that padding and borders will be added to the inside. Finally, our prayers have been answered! Just apply Box-Sizing: Border-Box to the entire document using * as the CSS selector. Make sure to add -mox- and -webkit- to format for older versions of Firefox and Safari. (See picture for example)
Now, sit back and enjoy inside padding and border and properly working layouts!





