Skip to content

Instantly share code, notes, and snippets.

@dospuntocero
Created June 27, 2017 01:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dospuntocero/ea41d4f3432f4b28e8233268b848751f to your computer and use it in GitHub Desktop.
Save dospuntocero/ea41d4f3432f4b28e8233268b848751f to your computer and use it in GitHub Desktop.
when you need to calculate measurements in vw, you need a context (starting point to define what will be 1vw) after that you pass the amount in pixels you want to convert to vws.
$context:960;// size you want to start calculating
@function get-vw($target) {
$vw-context: ($context * .01) * 1px;
@return ($target/$vw-context) * 1vw;
}
//usage
.page-obituary{
h1{
color: #2b6295;
font-size: rem-calc(30);
line-height: 1;
margin-bottom: 0;
@include breakpoint(800){
font-size: get-vw(30px);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment