This snippet is more than 5 years old and may no longer be best practise, test before use.

Using Border-box


Setting box-sizing to border-box brings padding and border values within the width specified, gone are the days of doing the maths, relax border-box has you covered. IE8+

Code: