11 lines
238 B
TypeScript
11 lines
238 B
TypeScript
export function remToPx(remValue: number) {
|
|
const rootFontSize =
|
|
typeof window === "undefined"
|
|
? 16
|
|
: parseFloat(
|
|
window.getComputedStyle(document.documentElement).fontSize,
|
|
);
|
|
|
|
return remValue * rootFontSize
|
|
}
|