Jacob V. Jacob V. - 1 year ago 118
CSS Question

Converting pixels into percentages using CSS

I have a rectangle, the width is

and the height is
. I am trying to make the rectangle 5% bigger. How can I get increase the rectangle by 5%, while knowing the width and height in pixels.

Answer Source

CSS's calc function is your friend:

.rect {
    width: calc(125px * 105%);
    height: calc(48px * 105%);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download