Skip to content

Instantly share code, notes, and snippets.

@starryeyez024
Last active December 9, 2019 16:55
Show Gist options
  • Save starryeyez024/e6d0b59724f6a9d966769c2d260a0d84 to your computer and use it in GitHub Desktop.
Save starryeyez024/e6d0b59724f6a9d966769c2d260a0d84 to your computer and use it in GitHub Desktop.
Generated by SassMeister.com.
> 1%
last 2 versions
<br/>
<div class="single"><p>single</p></div>
<div class="double"><p>double</p></div>
<div class="test"><p>test</p></div>
// ----
// libsass (v3.5.4)
// ----
// redhat-theme
:root {
--foo: 15px;
}
$padding: var( --foo);
// Use the calc function like this
$padding-double: calc( var( --foo, 12px) * 2) ;
// interpolate when a sass var is inside a calc function:
$padding-double: calc( #{$padding} * 2) ;
// This won't work:
//$padding-double: #{var( --foo, 12px)} * 2 ;
//$padding-double: $padding * 2 ;
// USE CASE EXAMPLES
.single {
padding: $padding;
}
.double {
padding: $padding-double;
}
// interpolate when a sass var is inside a calc function
.test {
padding: calc(5% - #{$padding-double});
}
// for demo
div {background: #eee;width: 300px;margin: 10px;float: left;}
<br/>
<div class="single"><p>single</p></div>
<div class="double"><p>double</p></div>
<div class="test"><p>test</p></div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment