Skip to content

Instantly share code, notes, and snippets.

View davidmatas's full-sized avatar
🏠
Working from home

David Matas davidmatas

🏠
Working from home
View GitHub Profile
@davidmatas
davidmatas / viewunits.scss
Created June 8, 2016 12:34 — 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