Including Border and Padding In Box Dimensions

Generally when I\’m assigning a width or height to a div, I want it to be that width or height. Yet some genius, whoever came up with the CSS box model, decided that the width of the box wouldn\’t actually include the padding or border as part of the width. Fortunately, we can now include the padding and border with the div\’s actual dimensions. Just add the following to the div:


     -webkit-box-sizing: border-box; 
     -moz-box-sizing: border-box;
     box-sizing: border-box;