4 ms·
Personally I think the most useful 'new' things in CSS that hardly anyone uses yet are the min, max, and Clamp functions. I wrote about them here https://blog.
by bryanrasmussen 5y ago
Personally I think the most useful 'new' things in CSS that hardly anyone uses yet are the min, max, and Clamp functions.
I wrote about them here https://blog.logrocket.com/min-max-clamp-css-functions/ https://blog.logrocket.com/min-max-clamp-css-functions/ - there are some real embarrassments in that article (probably due to me being busy with other things at the time of writing, and being outside my comfort zone [dealing with design]) - example silly statement: "these functions can accept anything that is a number or a calculable value, like the length of a variable, as an input." length of a variable? WTF did I write that for!?!
I could also probably have saved my time because the day after I finished writing it I found this post https://ishadeed.com/article/css-min-max-clamp/ https://ishadeed.com/article/css-min-max-clamp/ which makes a lot of the same points, less verbosely, and better, with much nicer looking examples because I guess this guy has a design sense.
on edit: I mean I am just jealous of the examples he made, I sweated trying to make something up to show the power of the functions and explain their use and I don't think I did a good job of it, didactically, and his examples were really good. Probably he sweated to, but they look effortless.
- pilaf 5y agoDo these functions make min-width and min-height obsolete? Or is there still any reason to use those instead of min()/max()/clamp()? Edit: just noticed the articles you linked have nice examples of combining the two (should've read first), and it makes perfect sense since min-width/min-height deal with how elements grow to fit their contents, while something like `width: clamp(...)` would be declaring the width instead.
- bryanrasmussen 5y agothey don't make them obsolete, but they do make them less important. Without these functions people probably have more media queries with min-width min-height max-width max-height, with them maybe one or two without media queries is needed.