Created
February 9, 2018 19:09
-
-
Save dospuntocero/c1e19dd3f57c13be83eb8fa4acfb8360 to your computer and use it in GitHub Desktop.
//px 2 vw - vh conversion tool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@function get-vw($object_width,$window_width:1440) { | |
$vw: ($window_width * 0.01) * 1px; | |
@return ($object_width / $vw) * 1vw; | |
} | |
@function get-vh($object_height,$window_height:768) { | |
$vh: ($window_height * 0.01) * 1px; | |
@return ($object_height / $vh) * 1vh; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
added a default width and height so you can use the function just passing the value to compare with.
width: get-vw(200);
if you want to get a value using a different width (good for responsive layouts), you can use the second value
width: get-vw(100,320);