· 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.

Earlier coverage

Related coverage

Also worth reading

  1. next.js 16.5.0-canary.59 released
  2. next.js 16.5.0-canary.56 released
  3. Frontier Design Benchmark
  4. Presentation: AI-Assisted Software Delivery: From Code to Production
  5. Qualcomm offers test drive of its rack-scale Nvidia AI challenger