Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vwxyutarooo/vcalc
https://github.com/vwxyutarooo/vcalc
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/vwxyutarooo/vcalc
- Owner: vwxyutarooo
- License: mit
- Created: 2017-01-15T23:39:11.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-07T00:04:41.000Z (almost 8 years ago)
- Last Synced: 2024-04-24T20:43:43.274Z (7 months ago)
- Language: CSS
- Size: 6.84 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
vcalc is an Sass function for calculate unit from px to vw or vmin.
## Install
```
$ npm install --save-dev vcalc
``````scss
@import 'vcalc';
```Set variable `$base-v-size` as you want, default sets `375` (iPhone6).
```
$base-v-size: 320;
```## Useage
|Name|Arg1|Arg2|
|---|---|---|
|vmin-calc|$values: px based value|$base: base viewport size|
|vw-calc|$values: px based value|$base: base viewport size|```scss
// $base-v-size: 375;
{
font-size: vmin-calc(16px);
}
```Will be `4.26667vmin`, which means
|Screen width|4.26667vmin In px|
|---|---|
|414px|18px|
|375px||16px|
|320px|14px|Also can pass multiple values
```scss
{
margin: vmin-calc(10px 20px 30px 40px);
}
```