Skip to content

Rem

@unsass/rem provides a consistent way to express CSS lengths in rem, converting from pixels against a single, configurable baseline.

Unlike em, rem always resolves against the document root, so conversions need no per-call context — just one baseline for the whole project.

Repository: github.com/unsass/rem

Install

sh
npm install @unsass/rem
sh
yarn add @unsass/rem
sh
pnpm add @unsass/rem

Basic usage

scss
@use "@unsass/rem";

.foo {
    font-size: rem.convert(16px);
}
css
.foo {
    font-size: 1rem;
}

Next steps

Released under the MIT License.