Best way to put variables inside of calc?
See original GitHub issueRight now I’m doing width: s('calc(100% * %s)', $fraction)
but that gets really hairy when I have several variables.
We should probably standardize variable interpolation as well. I think Sass does this pretty well. Their version looks like: width: calc(100% * #{$fraction});
and is much more readable/enjoyable to work with.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:3
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Sass Variable in CSS calc() function - Stack Overflow
To use $variables inside your calc() of the height property: ... Here is a really simple solution using SASS/SCSS and a math formula...
Read more >Using CSS variables inside `calc()` - CodePen
Insecure Resource. The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https....
Read more >calc() - CSS: Cascading Style Sheets - MDN Web Docs
The calc() CSS function lets you perform calculations when specifying CSS property values. It can be used with , , , , ,...
Read more >SASS Variable in CSS calc() function - GeeksforGeeks
Using a Sass variable inside calc() function: Variables in CSS have the ability to have different values for different elements but Sass ...
Read more >How and when to use CSS calc(): Tutorial with examples
In this tutorial, we'll get to know the CSS calc() function, why it's useful, and how to use it in your projects.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
You can simplify it a bit:
We’ll change syntax of interpolation (see #728), so Sass’ variant will be possible.
@Panya Thoughts on adding better interpolation?
Something similar to this syntax would be awesome: