Re:Modern CSS Code Snippets: Stop writing CSS like it's 2015
by zeroCalories on Sunday February 15, 2026 @09:41PM
(#47030292)
Tbh there's nothing really wrong with that. You don't need stuff like article or section if you set the right attributes. Often easier to just use divs to get the structure right, and figure out the meaning later.
[ Parent
| on HN ]
Re:Modern CSS Code Snippets: Stop writing CSS like it's 2015
by ordersofmag on Sunday February 15, 2026 @10:18PM
(#47030483)
And there's 'nothing wrong' with just writing code with variables named 'a1, a2, a3'. But when some poor sod has to dig through your mess to figure out what you had in mind it turns out that having an easier to discern logical structure to your code (or html) makes it better. I've dug through a lot of html. And there's a ton of ugly code smell out there. Layers and layers of "I don't really know what I'm doing but I guess it looks okay and I'll make it make sense later". I'm sure it pays the bills for someone. But it makes me sad.
Re:Modern CSS Code Snippets: Stop writing CSS like it's 2015
by mhuffman on Sunday February 15, 2026 @10:17PM
(#47030480)
Well, it does help if you expect sight impaired people with software to find the site useful.
Re:Modern CSS Code Snippets: Stop writing CSS like it's 2015
by zeroCalories on Monday February 16, 2026 @02:15AM
(#47031886)
That's why I said setting the right attributes. You can make a fully featured accessible website using only divs.
Re:Modern CSS Code Snippets: Stop writing CSS like it's 2015
by raincole on Sunday February 15, 2026 @10:36PM
(#47030593)
Exactly this.
I wonder if the people downvoted you realize that HN is basically just a big table and a bunch of div, and they use this very site just fine?
Re:Modern CSS Code Snippets: Stop writing CSS like it's 2015
by dotancohen on Sunday February 15, 2026 @10:48PM
(#47030668)
As a user, I don't care.
As a disabled user with a screen reader, I might care.
As a developer tasked with maintaining it after the original dev left, I most certainly would care a great deal.
Re:Modern CSS Code Snippets: Stop writing CSS like it's 2015
by raincole on Sunday February 15, 2026 @11:32PM
(#47030919)
As a developer you maintain the source templates, not the compiled/generated HTML. The HTML is messy doesn't mean the source templates are so.
Semantic web is basically "please think of the crawlers."
Re:Modern CSS Code Snippets: Stop writing CSS like it's 2015
by xmprt on Sunday February 15, 2026 @11:29PM
(#47030904)
Except that as a developer you have access to the original source code where things are well structured. It only turns into div soup after the React/Vue code gets compiled down to HTML+CSS+JS that can run on any browser.
Re:Modern CSS Code Snippets: Stop writing CSS like it's 2015
by zeroCalories on Monday February 16, 2026 @02:34AM
(#47032031)
Besides the points raised here, I think it's worth noting that using stuff like the article tag does not necessarily make things easier to maintain. You do indeed get a lower line count, but you're coupling the structure and meaning. Sometimes that's fine, but a11y can be tricky to get right and it's often easier to push it off until you've got something working first.
Re:Modern CSS Code Snippets: Stop writing CSS like it's 2015
by oneeyedpigeon on Monday February 16, 2026 @05:26AM
(#47033334)
It's possible to know that HN is basically a big table, use the site just fine, and still recognise that there are disadvantages to that approach.
Re:Modern CSS Code Snippets: Stop writing CSS like it's 2015
by chuckadams on Monday February 16, 2026 @09:48AM
(#47035670)
And it's nearly impossible to customize any part of the layout with user styles because of that.