-
-
Save jogboms/edb4447d430322a869f17c0f27872eb7 to your computer and use it in GitHub Desktop.
Concatenation of sass value+units.
See also: http://stackoverflow.com/a/9862328
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
// Set sizes without units | |
$basefont: 20; | |
$total-width-px: 1169; | |
$column-width-px: 72; | |
// Concatenation of units by addition results in conversion to string. This is bad | |
$basefont-px: $basefont+'px'; // = "20px" | |
// Conversion to pixels using multiplication | |
$basefont-px: $basefont*1px; // = 20px; | |
// Conversion to percentages using multiplication | |
$column-width: ($column-width-px/($total-width-px/100))*1%; // = 6.159110351%; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment