Doesn't look like they're supported by Chrome yet, but they're there in Firefox and Safari.
There's also `scrollbar-gutter: stable` to always reserve space for the scrollbar. It's not supported in Safari, but macOS uses overlay scrollbars by default anyway so it doesn't really matter.
body {
--scrollbar-width: 0px;
--320-to-1440: ( 100vw - ( 320px + var( --scrollbar-width ) ) ) / 1120;
}
h1 {
font-size: clamp( 20px, calc( 20px + var( --320-to-1440 ) * 10 ), 30px );
}
While accounting for the scrollbar width via JavaScript. document.body.style.setProperty(
'--scrollbar-width',
`${ window.innerWidth - document.documentElement.clientWidth }px`
);
This will be easier when user-defined functions arrive.never let the font size be smaller than 2rem
never let the font size be bigger than 3rem
the middle is then your fluid calculation of what the size should be between those two sizes.
since min, max, and clamp can be used in every property that can use calc it follows that lots of media query code can be replaced.
Finally when using media queries alone you will always run into some situation where something does not look that good if you are resizing your window and you are still in breakpoint 1 but you have not hit breakpoint 2 yet, you can of course fix that by adding a breakpoint in between these two, but the same problem presents itself multiple times.
Media queries alone will never give a 100% fluid experience.