HTML tag hierarchy
[Prev:: HTML tag use should convey meaning] because HTML defines structure and meaning of web content.
So why keep using <div> and <span>? 🤔
I use this tag hierarchy to support this:
- semantic:
<aside><article><nav><figure> - structural:
<p><ul><table> - custom (descriptive):
<user-profile><game-over><lotto-ticket> - generic containers when nothing else works:
<div><span>
This order prioritises semantics and structure over other aspects and aims to be accessible and SEO-friendly.