💡 CSS Tip! Do you want to detect the overflow of an element? Does it have a scrollbar or not? It's possible with only CSS (No JavaScript!) You can even style any element on the page using this information 🤩 Code & demo 👉 css-tip.com/overflow-det... ⚠️ Chrome only for now ⚠️ #CSS
Post
Yes, I did know – www.bram.us/2023/09/16/s... 😉 And soon you’ll be able to use scroll state queries for this: drafts.csswg.org/css-conditio... 🤩 Available in Chrome Canary behind a flag. @nerdy.dev has a bunch of demos built using it.
bram.usSolved by CSS Scroll-Driven Animations: Detect if an element can scroll or notLeverage Scroll-Driven Animations + a Space Toggle or State Query to selectively style an element based on it being scrollable or not.
Agree, came here to share the limits of the query vs the solution you're sharing, but you found it!
0 reposts1 like
No replies yet.