CSS min() and max() re-introduced
See original GitHub issue(edited by @nex3)
https://drafts.csswg.org/css-values/#calc-notation
A (maybe) quick solution could be to add a @
prefix – and while at it extend the math methods to cover pow, sqrt, cos, etc…
@min($numbers...)
@max($numbers...)
@abs($number)
@percentage($number)
@round($number)
@ceil($number)
@floor($number)
@random($limit)
// Sadly missing from Sass at this point
@pow($base, $exponent)
@sqrt($number)
@cos($number)
...
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:26 (11 by maintainers)
Top Results From Across the Web
ISSUE-203: Reintroduce min() and max() - W3C
Product: CSS4 Values and Units ; Raised by: Elika Etemad ; Opened on: 2011-12-12 ; Description: min() and max() were deferred due to...
Read more >min(), max(), and clamp(): three logical CSS functions to use ...
Showing how the max() function selects a value based on a list of options and its parent. See Demo on Codepen.
Read more >A guide to the min(), max(), and clamp() CSS functions
min() : Lets you set the smallest (most negative) value from a list of comma-separated expressions as the value of a CSS property...
Read more >Calc of max, or max of calc in CSS - Stack Overflow
No you cannot. max() and min() have been dropped from CSS3 Values and Units. They may be re-introduced in CSS4 Values and Units...
Read more >min() - CSS: Cascading Style Sheets - MDN Web Docs
When using min() to set a maximum font size, ensure that the font can still be scaled at least 200% for readability (without...
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 FreeTop 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
Top GitHub Comments
I ran into this issue today as well when converting my src from Less to Scss. I found that using Sass Function unquote rendered the correct output I was looking for.
In my Scss:
In my CSS:
I went this method instead of using
calc(max(...))
orm#{a}x(...)
routes because the first one made the resulting code look messy, and the second one just felt too hacky. Anyways, hope this helps someone.Define CSS
max()
andmin()
functions.These will keep your own code clean.