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

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: