logoalt Hacker News

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

119 pointsby eustoriatoday at 6:04 PM43 commentsview on HN

Comments

ktpsnstoday at 8:41 PM

CSS in 2025: Let's write html inlined styles as if it was 2005 and separation of formatting/representation was never invented. I talk of tailwind, of course.

show 4 replies
deadghosttoday at 10:19 PM

So where are we at with utility libs (tailwind/tachyon) vs inline css in js vs preprocessors (sass/scss) vs vanilla modern css?

show 1 reply
lol768today at 10:26 PM

I'm confused, many of these examples state that they don't work in my browser (Firefox) - but the live demo works fine? Are the demos poly-filled?

cwillutoday at 9:43 PM

Stop pinning things to the edges of the screen and window. Some sites have literally over 50% of the viewable area taken up by irrelevant static elements. Let the content scroll, like god intended.

Bengaliloltoday at 8:57 PM

Me: cool, let's be creative, I love 2026.

Browsers: Yeah, but beware of limited availability, most of those creative examples are in the 40-50% browsers support range.

show 1 reply
anematodetoday at 9:35 PM

Random pet peeve... it annoys me when people have old browser-specific aliases to standardized CSS properties. For example, -o-tab-size and -moz-tab-size instead of just tab-size. Those properties haven't done anything on Opera/Firefox for a decade!

jgalt212today at 8:51 PM

CSS and JavaScript are like two dysfunctional law enforcement agencies fighting over jurisdiction.

show 1 reply
piskovtoday at 8:41 PM

2015 is good enough.

For example instead of grid center, one can use flex and margin auto.

If you are building really nation-wide products, there are still a lot of guys in corporate with old windows (where even chrome stopped updating like win7). Or, you know, old or poor people with PC from 2008.

Also don’t forget guys with mobile phones: not like one could easily install a browser there. Especially on phones which no longer receive updates.

So writing CSS like it is 2015 is great. Not because it feels great but because it is what caring about your users (and business) is.

Otherwise you’ll get humbled by your clients soon enough. And in corporate they won’t even be your clients unless you support old stuff: IE 11 is a great target if you really want to shine.

show 3 replies
egedevtoday at 10:33 PM

[dead]

user3939382today at 9:24 PM

CSS is the only thing from browsers we actually need. The rest can be done in a terminal. Contemporary terminals could even render the UI with way less memory. The browser is a nightmare because it wasn’t architected to run applications.

show 1 reply
laacztoday at 8:39 PM

Is it just me or gradients and tile grid with specific hover effects are AI generated stuff giveaways? Maybe it's old people yelling at clouds, but I'm very reluctant to trust the site, when I see these signs.

show 2 replies