@gera2ld/rem
Adapt to different screens using rem.
Installation
$ yarn add @gera2ld/rem
Usage
import { scaleWidth } from '@gera2ld/rem';
scaleWidth();
// or
scaleWidth({
mode: 'px',
resize: false,
});
Options
-
mode
-
'vw'
Use
vw
as root unit if supported. -
'px'
Use
px
as root unit.
By default, if
vw
is supported,mode
is set to'vw'
, otherwise'px'
. -
-
resize
Whether the font size of root should be updated on resize. By default,
resize
is set totrue
ifvw
is not supported, otherwisefalse
.