6 ms·
Almond.css: Collection of CSS styles to make simple websites look nicer
- stevage 5y ago> By combining some "not-too common" HTML attributes with some CSS variables, we can generate a series of widgets without the need to use JavaScript or HTML classes. This sounds suspiciously like abusing semantic attributes for display purposes. At which point, surely it would be much better to use classes? Come to think of it, what is behind the design goal of avoiding classes?
- rendall 5y ago> This sounds suspiciously like abusing semantic attributes for display purposes. You don't need to be suspicious. The code is right there to evaluate at the bottom of [the demo](https://alvaromontoro.github.io/almond.css/demo/ https://alvaromontoro.github.io/almond.css/demo/). The circular progress widget shows this: <div role="progressbar" aria-valuenow="33" aria-valuemin="0" aria-valuemax="100" style="--value: 33"></div> Is it semantic? No. But it's not an egregious sin, either. Definitely not "abuse". I wonder if `<progress>` can be styled into the circular widget instead of `<div>`? I assume not.
- dsego 5y agoMaybe with pseudo elements (::before,::after) and gradients?
- rendall 5y agoVery nice-looking! When I read the title I was skeptical about YACSSF (yet another CSS framework), but this is absolutely a worthy addition to the canon. Well done.
- monk_e_boy 5y agoBut blue titles? Blue for hyperlinks, surely. Also, the buttons don't look like buttons.
- rendall 5y agoAlhough I disagree about the buttons, and don't think blue titles are a big deal, I do think those are valid criticisms. Easy enough to change those, yeah, if you like the rest of it?
- marapuru 5y agoI always tend to feel a bit agitated when the word 'nicer' or 'beautiful' is included in a headline or product tout. I get the idealistic idea behind this, but please tell me what is wrong with default browser rendering? It's consistent, fast and maintenance-free. It might not be following the latest design trends. But why should that be a thing? Staying clear from trends is something that simple (informative) websites _should_ have.
- code_runner 5y agoFor better or worse (I think better) a little polish and minimal effort gives a huge amount of credibility/trustworthiness to a website. Projects like this are even trying to make it so easy you don’t have to do much of anything. “I’d like my website to not use this” is an odd criticism. You aren’t being made to use it in any case.
- rendall 5y ago> please tell me what is wrong with default browser rendering? Default renderings, plural, because each browser's default is inconsistent with the next browser, and are generally regarded as ugly. You might disagree and think they are the height of informative minimalist beauty, but given that nearly zero websites use the default browser style, calling a "design trend" the use of CSS, is like calling a "fashion trend" this "wearing clothes" thing that people do these days.
- onion2k 5y agoplease tell me what is wrong with default browser rendering I'll take that bait. - The default font is Times New Roman. It's hard to read at the best of times, but on a mobile device it's truly horrible. - By default the color scheme is black text on white with bright blue links. On a page that has links embedded in paragraphs the sharp contrast change makes the links stand out too much, making text less readable. - Browsers make text expand to fill the window with an 8px margin. On a 4K monitor with a maximised window that means the margin is 0.21% of the available space and paragraphs are usually just one long line of text. Again, it's not very readable. - Browsers don't apply 'text-rendering: optimizeLegibility;' by default, so the algorithm used for anti-aliasing makes the text (guess what's coming...) less readable, but it does render faster by a few milliseconds. - Forms can layout very weirdly if you're not careful, with spacing around labels that makes it unclear what element the label applies to. There's a lot more to add, but I'll stop there. The fact is that browsers have moved on, display tech has changed, and there's a much wider range of devices used to view pages. There just isn't a set of defaults that works well any more. I'd argue that there isn't even a single set of defaults that could work - websites need to optimize the way content is displayed for the device being used. The defaults for a small mobile device should be very different to the defaults for an 8K HDR monitor. Relying on the browser to work out how something should work for a user just won't work now.
- samuba 5y agoI really like working with those class less css frameworks. Very nice for prototyping. Adding tailwind in later works too. A favorite of mine is https://picocss.com/ https://picocss.com/ Here is also an extensive list for more: https://github.com/dbohdan/classless-css https://github.com/dbohdan/classless-css
- swyx 5y agoi keep a list of other "drop in" css frameworks here https://github.com/sw-yx/spark-joy/blob/master/README.md#drop-in-css-frameworks https://github.com/sw-yx/spark-joy/blob/master/README.md#dro...
- chrismorgan 5y ago> Lightweight: limit the size to 3KB (gzipped). $ curl -H 'accept-encoding: gzip' -I https://alvaromontoro.github.io/almond.css/dist/almond.min.css | grep content-length content-length: 4198 Looks like they slipped past their alleged limit and didn’t notice or didn’t update their documented target. My observation with this kind of stylesheet is that they normally do slip like this. I would also say that 19KB/4KB gzipped is not particularly lightweight for this type of stylesheet, though in its defence it is more thorough in its element coverage than most (… which just means that the significant majority of it will be dead code on most pages). For the rest, I’m not going to go into it (nothing stands out as particularly good or bad) save this one point that offends me greatly: --font-weight-bolder: 700; --font-weight-bold: 400; --font-weight-normal: 200; --font-weight-thin: 100; These figures are offensive. 700 is bold, 400 is normal, 300 is unpleasantly thin at 16px on most platforms and most fonts (macOS under default configuration being the exception, as they perform glyph dilation that no one else does), 200 is illegibly thin below maybe 30px, and 100 is hairline, not to be used below around 50px. The font stack of `Helvetica, Arial, sans-serif` is the dubious salvation of these weights (a dodgy font stack too, by the way, better simplified to just sans-serif), as I think (but certainly don’t know) that all platforms will by default resolve this to a font that does not possess a lighter weight than 400. But if someone has it resolve to a font that does contain a weight below 400, you’ve just wrecked the page for them.
- moritzwarhier 5y agoCame to the comments because of this. Font renders very thin on my Android device (Firefox and Chrome). Setting the default font size to 200 should strike every web developer as a questionable idea. It doesn't look "elegant" or anything like that to me, it just looks off and unpleasant for regular text, with the bonus of being hard to read. Recently I had to implement a web design where the default font weight was 300. Same there, just seems like a bad idea to me. Fads come and go. Ultra light fonts mostly just feel like a signifier for poorly thought-out promo content to me. Reminds me of early 2000s print ads too. Don't mean to insult the author, the same description perfectly fits the site that I had to implement.
- 5y ago
- thieu96 5y agoThis is the third classes css framework I've come across on HN. Please everyone realise this is a great tool for prototyping or projects you want to deploy, deliver and forget about. Any serious application that you expect to expand on, that needs some level of customisability or needs to import/use third party components(!) like a datepicker should not use classless css. it's a prototyping tool. It's highly incompatbile with everything besides what you write yourself, because it overwrites the defaults, it's inflexible. Having classless styling has been possible for as long as css has existed, and it's for good reason that this is not in widespread use in usual application development. Having said that though, I really like how this one looks it's an improvement without going overboard on anything, good job.
- typeofhuman 5y agoDefault font weight is way too low.
- kristopolous 5y agoI honestly thought that went out of style about 10 years ago. I ran a gallery page called unreadable.website that featured the worst offenders. I had thought the problem mostly went away. Even let the domain lapse. Here's the code https://github.com/kristopolous/lowcon https://github.com/kristopolous/lowcon
- toastal 5y agoHSL and HSV are terrible color representations for theming like this. You are just asking for chroma issues. LCH and Lab (along with OKLCH and OKLab) are offered in the CSS4 spec. If you can't support CSS4, it's better off having users specify the whole color.
- clairity 5y agois it worth the complication of learning about the different color space options for the average developer? why aren't hex values 'good enough'? it's unclear (as a non-specialist) what problems those options are trying to solve.
- toastal 5y agoI wouldn't say I disagee with you which is why I mentioned just allowing a full color, be that hex, rgb, hwb, lab, etc... including color() which lets you define in absolute terms in various color spaces.
- CyanDeparture 5y agoI think this is quite an opinionated version of nicer and better. I'm personally not a fan of the thin fonts. If it was framed as a class of CSS styles to make websites have that style of super-thin fonts I'd be ok with it. My issue with this is the framing of what the CSS library is.
- unfocussed_mike 5y agoThere are some small unresolved issues with line, heading and paragraph spacing too (particularly around multi-line list items here). Which is not to be overly critical because a lot of this stuff is art more than science, and it's hard to pin down precisely what is wrong without recalculating quite a lot, but I don't think this feels quite as balanced as it could.
- NoGravitas 5y agoNot exactly related to the CSS, but to the demo. I had not realized that (desktop) browsers actually had functioning date and time pickers now, without JS. Fantastic!
- tyingq 5y agoThe demo has a <input type="date">, but it seems to have suppressed the normal html date picker, without using any javascript. I'm using windows/chrome. How it is doing that?
- bob1029 5y agoMaking something look good does not require a whole lot of CSS. Over time, I learned that I did not need to use frameworks to make good-looking websites. I have adopted a philosophy of minimalism when it comes to overriding the default user agent styles. The fewer layers of overrides and indirections, the better. Simply throwing border-collapse on top of a plain-ass HTML report can make all of the difference in the world. I just checked the site.css for my most recent internal web project and it's sitting right at 1,148 bytes. That's un-minified, human-friendly bytes. Can't imagine I would need to tweak it much further from this point.
- oblak 5y agoNon-insignificant part of my job is deleting css (and js)
- minroot 5y agoThe fonts are so thin, what is wrong with you
- chris_st 5y agoI'm a fan of Sakura[0] for this purpose. About the same size, different design choices. It hasa recently-added dark version, which can do the OS-choice switch without javascript. [0] https://oxal.org/projects/sakura/ https://oxal.org/projects/sakura/
- oxalorg 5y agoThis is quite nice! Shameless plug for my version of this (sakura.css [1]) which is - much smaller (3.9kb / 1.9kb gzipped) - looks more in-line with the default browser styles (demo [2]) - but does not use css variables yet, instead different themes are provided as different css files. My reasoning for this is that if you're using this you probably don't want to mess around with css too much :) [1]: https://github.com/oxalorg/sakura https://github.com/oxalorg/sakura [2]: https://oxal.org/projects/sakura/demo/ https://oxal.org/projects/sakura/demo/
- politelemon 5y agoThanks and you've actually got a demo
- kaishiro 5y agoThere is a demo for almond.css at the bottom of the second paragraph: https://alvaromontoro.github.io/almond.css/demo/ https://alvaromontoro.github.io/almond.css/demo/ Certainly could stand to be elevated in the readme as it's generally the first thing people look for.
- fuddle 5y agoIt would be helpful if there was a website with demos available.
- clairity 5y agobeyond the demo that's linked in the readme? https://alvaromontoro.github.io/almond.css/demo/ https://alvaromontoro.github.io/almond.css/demo/
- clairity 5y agoi was looking at this earlier and thought it would make for a great starter kit for a personal design system. it has enough meat to it to feel like you're not starting from scratch, but not so much that you'd be fighting the defaults very much. i find the choice of hsl colors a little odd (and font weights a little light, as others have mentioned), but overall, it's a solid base. and it accounts for every html tag, not just a somewhat arbitrary selection of them. i've been trialing some css frameworks (bootstrap, bulma, semantic/fomantic, tailwind) for a side project, and i dislike each for various reasons. bootstrap and tailwind encourage class soup, while bulma encourages div soup. semantic/fomantic have a pretty dated looking design language, though the semantics (ha) are much better. so that led me to thinking about creating my own design system with something like almond.css as a base, so i don't have to deal with the analysis paralysis that comes with bootstrapping from scratch.
- tshaddox 5y agoI like this tool for previewing many drop-in CSS frameworks (doesn't look like Almond is in the list yet): https://dohliam.github.io/dropin-minimal-css/ https://dohliam.github.io/dropin-minimal-css/
- dohliam 5y agoThanks! Almond CSS has now been added to the list: https://dohliam.github.io/dropin-minimal-css/?almond https://dohliam.github.io/dropin-minimal-css/?almond
- jug 5y agoList of classless CSS frameworks: https://github.com/dbohdan/classless-css https://github.com/dbohdan/classless-css