https://github.com/gera2ld/rem
Adapt to different screens using rem.
https://github.com/gera2ld/rem
Last synced: 3 months ago
JSON representation
Adapt to different screens using rem.
- Host: GitHub
- URL: https://github.com/gera2ld/rem
- Owner: gera2ld
- Created: 2018-12-08T16:31:54.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-04T15:03:18.000Z (over 7 years ago)
- Last Synced: 2026-02-23T18:45:33.148Z (5 months ago)
- Language: JavaScript
- Size: 7.81 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @gera2ld/rem



Adapt to different screens using rem.
## Installation
```sh
$ yarn add @gera2ld/rem
```
## Usage
```js
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 to `true` if `vw` is not supported, otherwise `false`.