What is semantic HTML and why does it matter beyond visual presentation?
Semantic HTML means using elements that describe the meaning and role of content, not just its appearance. A <nav> element tells the browser, screen readers, and search engines that its contents are navigation links. A <main> element identifies the primary content of the page. An <article> marks self-contained content that could stand alone (a blog post, a news story). The consequences of getting this wrong are real: screen reader users navigate pages by landmark regions β if your header is a <div>, keyboard-only users lose the ability to skip directly to content. Search engines use heading hierarchy (<h1> through <h6>) to infer topic structure and page authority. Chrome's accessibility tree is built from semantic elements; non-semantic layouts require extensive ARIA patching to make them equally accessible, which is error-prone.
Practical note
A common interview test: ask candidates what the difference between <section> and <div> is. A <div> is purely presentational with no semantic meaning. A <section> implies that its content is thematically grouped and typically has a heading. Knowing this distinction signals architectural intent.