🚀 Responsive Toolbars and Navbars - Done Right!
Look ma, no media queries! Responsive design is basically solved nowadays, right? We've been doing media queries for over a decade, we have @container queries now, and we have cool tricks like CSS Grid's repeat(auto-fit, minmax()). All this works pretty well, especially when things are static. But if you are dealing with dynamic content, things can still get less than perfect 😅. It's especially easy to trip over toolbars, even for the pros: Common failures: site with dynamic navbar goes wrong 🥺 blog.google at 1025px 😥 cloudflare.com English is fine, but German or Polish not so much 😭 OpenAI docs below 820px wide are not even dynamic, and still break 🤮 This happens because you can't really solve this when there is dynamic content using pure CSS, where you have to rely on fixed pixel breakpoints. To solve it correctly and robustly, you're gonna need some JS, or smart tools 🤓 The way to fix all of those is to detect when those navbars overflow. It's actually not that difficult, and a competent AI agent can whip up some HTML+JS or React code. OverflowGuard to the rescue 🛟 And you can stop here and call it a day, I guess 🤷♂️. But we can make this even easier by using a smart tool: OverflowGuard. It does exactly what it says on the tin 🏷️: it detects overflow and lets you swap in alternative styles or content. It has two flavors: Pure HTML version 💎: a custom element, useful when doing vanilla HTML or using frameworks like Astro. See the same example built with it (notice no JS an...
👉 Read more: https://dev.to/arturmarc/responsive-toolbars-and-navbars-done-right-425b
