24 Apr, 2014

Padding and borders inside the element’s width

When using percents to define the width of an element, together with padding or borders, the actual size of that element is bigger than expected. That is because its width is now: percentage + (border/+padding). To avoid that, the following code can be used: