Skip to content

Instantly share code, notes, and snippets.

View floriangouy's full-sized avatar

Florian Gouy floriangouy

View GitHub Profile
@floriangouy
floriangouy / viewunits.scss
Last active February 22, 2017 17:36 — forked from seavor/viewunits.scss
Sass Mixin for V-Units to PXs for unsupported devices (vw, vh, vmin, vmax)
@function vunit($input, $width, $height){
@if unit($width) != px or unit($height) != px {
@error "function vunit() dimensions should contain a px unit. +[" + $width + ", " + $height +"]";
}
// Store $input unit
$unit: unit($input);
// Remove unit from $input and convert to ratio
$ratio: $input / ($input * 0 + 1) / 100;
// Calc and store return values