How to combine different units in CSS

2016-02-10 | #css, #solution, #webdev


Nope, not anymore, thought so too. Its finally here and ready. For any modern browser you can now safely do things like:

.thing {

position: absolute;

top: calc(50% - 25px);

right: calc(25% + 50px);

bottom: calc(50% + 25px);

left: calc(25% - 50px);


Works with the other units too. Hooray.

Praise the lord!