Math with interpolated variables?
Posted
by
Idan Gazit
on Stack Overflow
See other posts from Stack Overflow
or by Idan Gazit
Published on 2011-11-24T09:43:50Z
Indexed on
2011/11/24
9:50 UTC
Read the original article
Hit count: 305
sass
Consider the following sass:
$font-size: 18;
$em: $font-size;
$column: $font-size * 3; // The column-width of my grid in pixels
$gutter: $font-size * 1; // The gutter-width of my grid in pixels
$gutter-em: #{$gutter / $em}em; // The gutter-width in ems.
$column-em: #{$column / $em}em; // The column-width in ems;
$foo = $gutter-em / 2; // This results in a value like "1em/2". :(
$bar = ($gutter-em / 2); // this doesn't work either, same as above.
How can I generate a $foo
that works, and that I can reuse further in other expressions?
© Stack Overflow or respective owner