CSS

const rem = parseFloat(getComputedStyle(document.documentElement).fontSize)

get the number of pixels in a rem in JavaScript