· javascript
scroll-state()
query, surprisingly, has nothing to do with whether you’re doom-scrolling in a state of existential dread.
It does, though, allow you to change the CSS used based on scrolling behavior. Far from doom, that’s pretty neat-o speedo.
(Okay, you’re right, there’s nothing neat-o about a speedo). You can do lots of things that used to require JavaScript, like revealing the navigation when a user scrolls up or animating in a back to top link once the user scrolls down.
While scroll-state(), with those slimming parentheses, looks like a function, it’s not technically one. It’s a container query (@container) like style().
Since scroll-state() is a query, the website is basically asking the browser whether a particular feature of a container has a specific value. If it does, the styles within the brackets will apply.



