Live data from Hacker News

Modern CSS Code Snippets: Stop writing CSS like it's 2015

modern-css.com

271–280 of 318 posts

Re: Modern CSS Code Snippets: Stop writing CSS like it's 2015

#271
post #231
post #217

Earlier quoted context omitted.

Wait until sites start rendering to canvas. You will yearn for the days of div soup.

why should they? this has been a worry for some time, but I don't see it happening

There's an active proposal for rendering html in canvas to control styling. Text rendering and accessibility are main focuses for the proposal.

https://github.com/WICG/html-in-canvas

Re: Modern CSS Code Snippets: Stop writing CSS like it's 2015

#272
post #43

Earlier quoted context omitted.

The deadest horse in web development is the myth of “separation of concerns”

I was recently doing some very specific web scraping of some very public very static documents. About 25% of them use a soup of divs with hashes for class names. Not a or or in sight. I am fine with the idea of what tailwind does but like at least using semantic tags where appropriate could be a thing.

Not defending it, but this is most likely a cause of using some enterprise CMS like Adobe AEM which is notorious for doing stuff like this.

Its not right, but a lot of times CMS's are horrifically bad at adding content without a slew of nested, auto-generated 's.

Re: Modern CSS Code Snippets: Stop writing CSS like it's 2015

#273
post #232
post #211

Earlier quoted context omitted.

Jumping up and down in the file is not much better and you still need to come up with names for classes. I want to look at an element and immediately know how it's styled.

From Tailwind's home page: [...] "immediately" is a stretch

I think your point has very little to do with tailwind and everything to do with CSS. Tailwind is optimized for modification and maintainability. We could replace your example with

...

but now any time we want to modify hero-header, we're trolling through the whole site to find where else these classes might be used so we know what to test to avoid breaking anything

Sure it's easy to look at the element you shared and say it's too complex (it's really not, it's very declarative), but the complexity must live somewhere, and I'd choose Tailwind over any other prevailing system because it's isolated and safe to modify

Re: Modern CSS Code Snippets: Stop writing CSS like it's 2015

#275

Earlier quoted context omitted.

Colocation is a useful principle in component-based architecture.

As much hate as it gets, this is one thing I like about Angular.

imo Angular would have won had it figured out a stronger path from v1 to v2

Re: Modern CSS Code Snippets: Stop writing CSS like it's 2015

#276
post #258

Alternate title: "How to break your website's styling for 10-20% of your users" This is a nice reference, and some properties like `scrollbar-gutter` can be used for progressive enhancement. However, many options listed will require some kind of fallback if `autoprefixer`/`postcss`/etc. doesn't cover it, and if you don't want to exclude a large fraction of your users. It's reasonable in some cases to have both "new"…

Is it 10-20% of "your users" or 10-20% of the world but <1% of "your users"

Re: Modern CSS Code Snippets: Stop writing CSS like it's 2015

#277

Earlier quoted context omitted.

Css modules gets away from the larger sins of the massive global css files. If modules had existed much earlier it probably would’ve gotten rid of most of the awfulness.

Oh, great. So let’s just 2x all our files then! All for, what exactly? It sounds like you just want to write Java.

If you have a complaint about your styles being so complicated and in a giant 900 line mega file, I don’t see how you address physical size other than breaking up the file.

Granted, nesting support was also added fairly recently in the grand scheme of things, which boggles the mind given how it was such an obvious problem and solution that CSS preprocessing came about to address it.

Re: Modern CSS Code Snippets: Stop writing CSS like it's 2015

#278
post #237

Earlier quoted context omitted.

Firefox is pretty irrelevant nowadays. They've dragged their feet for years when it comes to implementing new stuff, and now web devs don't even bother checking Firefox. Because devs know it won't work on ancient browsers, no need to confirm. My personal trigger events were when Firefox didn't optimize DataView for the longest time, initially refused to implement import maps, and couldn't get WebGPU support done. At…

"widely available" has a precise meaning that includes Firefox (both desktop and Android). it might be irrelevant for some, but let's not twist industry definitions

Based on marketshare, Firefox can easily be excluded from "widely available"

Re: Modern CSS Code Snippets: Stop writing CSS like it's 2015

#279

Earlier quoted context omitted.

Firefox is pretty irrelevant nowadays. They've dragged their feet for years when it comes to implementing new stuff, and now web devs don't even bother checking Firefox. Because devs know it won't work on ancient browsers, no need to confirm. My personal trigger events were when Firefox didn't optimize DataView for the longest time, initially refused to implement import maps, and couldn't get WebGPU support done. At…

It's 2026, the most useful stuff was implemented over a decade ago. Stop trying to make the web platform do everything when it wasn't designed for that.

It doesn't matter what it was designed for 30 years ago. Computers also weren't designed to be put in your pocket, yet here we are. Things evolve, and browsers that do not keep up will eventually stop being used.
Post reply on HN