Skip to main content

Module: Converters

This module is a collection of functions for converting values between different CSS units. You'll find it in src/modules/_converters.scss.

  • Function length-rem converts any length unit to an approximate equivalent in rem.
  • Function length-px converts any length unit to an approximate equivalent in px, but it also takes a given font-size into account. This function is useful for creating media-queries from a font-size-relative length value.
  • Function font-size-rem converts any font-size to an approximate equivalent in rem, even from named font-sizes like x-small and larger, as well as relative values in percentage and decimals.
  • Function font-size-px converts any font-size to an approximate equivalent in px.
  • Function font-size-em converts any font-size to an approximate equivalent in em.

Want better convertion rates?

It shouldn't be needed, but you can set your own convertion ratios before importing the module. Check out the Sass variables at the top of the module file for options!