Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Tailwind is great, but ironically it is full circle in regards to OP's post. You describe the page structure in HTML using classes, much the same before CSS was a thing. This is ideologically opposed to semantic HTML where you describe what the structure is, and not how it is. Using server side frameworks hides this, as long as you don't need to write static HTML. Tailwind has plenty of hype behind it and it's good, but it also has plenty of downsides too. As long as you're aware of where it's be suited for. I think Tailwind is a CSS framework for people who don't want to do CSS.


Semantic HTML is about using the write HTML tags for the right things, like <article>, <figure>, etc. The strings you put inside the class attribute are completely orthogonal to this — Tailwind has absolutely no influence on whether your HTML is semantic or not.

We worked with several accessibility experts when building Tailwind UI for example, and I am very confident in the semantics of all of that markup and how it performs in situations where that actually matters like when using assistive technology, because we tested it ourselves.


> The strings you put inside the class attribute are completely orthogonal to this — Tailwind has absolutely no influence on whether your HTML is semantic or not.

To add to this, screen readers for accessibility and search engine bots don't read CSS class names because they don't have standardised semantics (unlike HTML tags). Minifiers are allowed to mangle CSS class names because of this.

I think the problem here is it's common for people to confuse semantic HTML with semantic CSS class names. The latter are really to help your developers. If you're using utility classes though, you tend to use custom components to wrap + reuse styles versus using custom CSS classes so semantic class names aren't as important anymore. For others, this is explained well here:

https://tailwindcss.com/docs/utility-first

https://tailwindcss.com/docs/reusing-styles

I think the OP article is a good story on how we shouldn't cling on to current best practices. CSS was invented before complex single-page-applications were even a thing so it shouldn't be surprising at all if it turns out the old way doesn't scale well to our current needs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: