r/webdev • • 12d ago

Showoff Saturday modest-ui: classless CSS that styles plain HTML

I’ve been building websites for over a decade, and have always tried to do things as vanilla as possible (where applicable).

More recently whilst building components and looking at the libraries out there, I realised that browser technology and CSS has grown to a point where it can do the majority of things we need, without JS (like dialog, detail, and popover tags)

So I started working on modest-ui as a CSS base for all my personal and side projects, and as it’s gotten more stable I’ve recently bumped it to v2.

It’s themeable with CSS vars, can be used as an unobtrusive base layer to built on top of, and can either be used classless (with mdst-ui set on the body) or you can pick and choose classes as needed.

Anyway, it’s open source (MIT), no JS (except for some examples on the site), and currently sits at about 10 kb (gzipped).

https://github.com/thisismodest/modest-ui
https://modest-ui.com

Edit: I forgot to mention it’s ~10kb when gzipped

106 Upvotes

31 comments sorted by

View all comments

Show parent comment

1

u/deveronipizza 11d ago

I have never heard of these attributes, can you elaborate?

2

u/waterkip 11d ago

You can create attributes willy nilly. The trick is to create a language that conveys meaning to element.

<button class=danger> does say something about the button, bit it does not convey meaning. Now take <button antagonist>. The attribute tells you that it ia the opposite of what the UI is trying to force. Now take a payment page where you have pay, add to cart and cancel order.

Cancel order becomes your antagonist, pay is the lead and add to cart is support.ibuse very little classes, when I do it is to override the recipe of the button where i change the color.

2

u/deveronipizza 11d ago

I see, like a data attribute.

0

u/waterkip 10d ago

Like an attribute yes.

1

u/St34thdr1v3R 8d ago

They specifically meant data-* Attributes which is the recommended way to avoid naming clashes: https://www.w3schools.com/tags/att_data-.asp

1

u/waterkip 8d ago edited 8d ago

Yes I know what they meant and no I don't use them. Which is why I said what I said. If you want to implement them as data-* or x-* feel free to do so. 

You could also opt for namespace-*, its is unlikely to become a standard attribute: waterkip-lead, but its ugly and when the w3c introduces something I'm using, I can go nag about the w3c. Win-win.