HTML Semantics and Document Structure
Semantic HTML
Meaning over appearance
Semantic HTML uses elements for their intended meaning rather than for visual effect alone. Elements like , , , , , and help browsers, screen readers, and developers understand the document structure.
Why semantics matter
Good semantics reduce ambiguity, improve accessibility, and make code easier to refactor.
Document outline
Organizing content logically
A page should typically contain one main region, logical headings from through , and content grouped into meaningful sections. Headings describe hierarchy, not just style, so avoid skipping levels without reason.
Common structural elements
Lists, tables, forms, figures, and captions should be marked up with the correct elements. For example, navigation links belong in , supplementary material can live in , and images with context should use and .
Which element is most appropriate for the page’s primary content area?
The element represents the central content unique to the page.
Correct answer: main
Why is it a bad idea to use headings only to make text look larger?
Assistive technologies and search engines use headings to interpret hierarchy.
Correct answer: Because headings should represent document structure and meaning, not just visual styling.
Practical example
A blog post might use for the post, for the title and metadata, for the article body, and for author details or tags. This structure helps both humans and machines parse the page.
Name one HTML element commonly used to group a standalone blog post.
An element is appropriate for standalone, distributable content such as a blog post or news item.
Correct answer: article