Inter-unit CSS calculations

calc() works for

  • px and rem
  • % and px
  • % and em
  • vw and px
// Convert Pixels to Ems
// (px / base-size) * 1em
// multipley by 1em is to cnvert unit to em

padding: (40px / 16px) * 1em

```css .container { width: calc(100vw - 80px); }

.container { width: calc(100% - 1em); }

.container { width: calc(100% / 6); } ``