[dead]
Making a standard horizontal nav menu that can also collapse to a toggle-able mobile side menu is one of those things that just exposes how CSS is truly the most tedious, horribly-designed thing in the history of computing.
I started trying to learn how to do this by following tutorials and a copying a lot of big websites that had visually attractive designs and in the end every single one is actually full of bugs, has no accessibility, or requires a brittle pile of 12+ different CSS directives that collapse if they're not all put together perfectly.
Through looking at these big sites, I have realized a lot of them write two completely different nav bars and just hide one when you swap to a mobile view. This helps a bit, but the fixed/absolute positioning crap you have to do to float things for the mobile-style menus is still hideous heap of hacks.
Hi HN, I'm Fandy.
This started in 2018 as the stylesheet I kept copying between client projects. Most were server-rendered apps, and every one ended up loading a JS library just to open a dropdown or a modal.
Browsers caught up. <dialog> with commandfor, popover and :has() now do most of that natively, so this year I rebuilt the kit around them. The link is one HTML file, an invoicing screen, with only the stylesheet and no script. Menus, the dialog, the drawer, tabs, tooltips and the toast all work. Turn JavaScript off and try it, then view the source.
It isn't classless like Pico (sad to see Pico stop). You write classes on a fixed scale, so page 30 still matches page 1.
That fixed scale is also why it works well with AI. The quickest way to try it on your own project: tell your AI "Build a settings page for my app with Alloy CSS. Read alloyhtml.com/llms.txt first." Then run npx @alloyhtml/css check on what it wrote, and it lists any class the kit doesn't have.
And yes, I used Claude a lot this year for the grind: stripping out JavaScript, the dark themes, the test suite. Happy to talk about how that went.
MIT, about 24 KB gzipped, from jsDelivr or npm. Dialogs need Chrome 135, Firefox 144 or Safari 26.2; the rest works a bit further back.
I also sell page templates built on it, which pays for the time, but the CSS is what this post is about. Tell me where it breaks.
JS is needed, for clicks, state, events, queries, updates, nothing else
If you use a framework, JS is not the issue, you are. But if you try to remove the web parts needed to make something simple and useful you end up with a soup of hacks that benefit nobody, specially the psychopath maintainer of your mess
HTML, CSS and JS have their exact place in the web stack
I literally just ran into an issue where I made a sandbox a little too restrictive and claude couldn't pull down a javascript runtime in order to complete its little unittests. Now I'm wondering how much time Claude has spent spinning up V8-isolates for mostly static frontends that i just didn't know about.
The classes are many and use common names that would conflict with existing style making this tedious to add into existing, but for green field I might give it a try. Maybe your css builder lets me prefix?
Yeah, that'll conflict, I built this as a whole new design system, not a drop-in utility layer, so even though it's meant to be simple, there's still a learning curve dropping it into something existing. Two options: email me at support@alloyhtml.com and I'll point you to just the classes you'd actually need, or if you've got some time to explore, point your AI at alloyhtml.com/llms.txt and have it rebuild your page with Alloy to see what it'd look like.
Cool exercise, but it's a lot of work that nobody is interested in. I know because I used to be a big proponent of "progressive enhancement" but nobody cared.
I guess that now that code is free you can turn it into a skill and hope for the best; but the moment you need more complexity you're going to build Rube Goldberg machines.
Code might be 'free' nowadays but my internet surely isn't. I switched internet providers last year and I had 2 weeks of really bad and slow internet. Why does the Jira board use 42MB for a simple page? Frameworks...
I most of the time ask agents to create html instead of markdown as it is easy to understand in case of diagrams etc and use tailwind. Will give this a try.
[flagged]
doesn’t seem very accessible which is the downside to js-free widgets
Fair point, and I'd really like to know where it fell short for you. What did you try? The weak spot I know of is the tabs: a screen reader hears them as radio buttons, not tabs.
What aspect of it isn’t accessible? Would love to know.
For example: a screen-reader-only user doesn't know that the "Selected invoices" banner appeared, together with the download button. You'd need to use certain ARIA labels to inform the screen reader that the dynamic content of the page changed.
This is why I gave up doing css only for this kinda stuff a looong time ago. It’s cool you can do it but not so fun when you get lawyers claiming your site isnt accessible.
Only confirmed one so far is the tabs reading as radio buttons to screen readers. If you hit something specific before, I'd actually like to know what.
If I was working on web standards, I would focus on trying to make the browser able to do as much as possible without JavaScript. Having to use JS to post a form dynamically for example is extremely overkill and a security problem. If we could avoid it more often, we could use CSP headers and disable it on a lot more security critical sites. If doing accessibility is a problem without JS, well then there's a great thing to get started on fixing.
Just read this article this morning which I think highlights the problem: https://www.newsweek.com/cyber-attack-websites-affected-1272...
I think it's really cool that browsers are VMs that can run Doom now but I really think we need to come back and focus on the basics again: HTML as hand-editable documents you read, more interface components, accessibility tools. Not sure the Gemini protocol (https://en.wikipedia.org/wiki/Gemini_(protocol) will succeed but I understand and loved the spirit of it.
This is essentially what we're working on at Open UI (https://open-ui.org/). Many of the primitives this page uses (e.g. `popover`) were incubated in Open UI, and were designed to essentially extract & encode common problems in the web. Developers shouldn't have to spend months writing libraries or patterns for their UI.
I concur. When one considers how much time, effort, and frustration has been poured into the tens of thousands of re-implementations of the same handful of patterns, most of which are poor on some level, the mind boggles.
The ROI on better web UI fundamentals is incredibly high. Even if people ultimately just bolt JS onto them anyway it'd still be a massive win.
HTMX has entered the chat.
Now you know why google is incentivized to create a browser
Trying to imagine a world where ActiveX won
To push ads faster.
and block the blockers?
I really like the idea of minimalism and doing as much as possible without js. I love the look and feel of sites that do what they need without client side programming. Maybe I'm just old fashioned but it seems more permanent, more stable, more content oriented, more useful
[flagged]
It's more of a hassle and a lot of the time is a bunch of unintuitive hacks. I hope we see more mainlined APIs for the browser instead
[flagged]
Like many things there is a good middle ground. HTML dialog and popover APIs are great, but combining that with javascript helps smooth out the rough edges.
A good example of this is the toast notification on this site. It is cool that we can pop up a toast using only HTML... but it can't be dismissed by anything other than user interaction.
[flagged]
> it can't be dismissed by anything other than user interaction.
This is as it should be. Notifications that disappear are bad accessibility https://www.scottohara.me/blog/2019/07/08/a-toast-to-a11y-to...