What semantic HTML means

Semantic HTML uses elements according to the meaning of their content. A navigation area belongs in nav, the main page content belongs in main, and a self-contained article can use article. These elements communicate structure to browsers, assistive technologies and developers more clearly than a page made entirely from generic div elements.

Start with a meaningful document outline

Use one clear main heading for the page's central topic, then organise related sections with h2 and nested subsections with h3. Choose heading levels based on hierarchy, not visual size. CSS should control appearance; heading elements should describe the structure. A logical outline helps visitors scan and navigate long pages.

Use landmarks for major regions

Elements such as header, nav, main, aside and footer identify major page regions. Use them where their meaning fits. A page should normally have one primary main region. Give repeated navigation areas distinct accessible names when users need to tell them apart, such as a primary menu and a footer menu.

Choose controls that already behave correctly

Use button for an action and a for navigation to another location. Use label with form controls, and use lists for groups of related items. Native elements provide keyboard behaviour and accessibility semantics that custom clickable div elements do not provide automatically.

Images and tables need context

Write alternative text that communicates the purpose of an informative image. Decorative images should generally have empty alt text so assistive technology can skip them. Use table for genuinely tabular data, with header cells that identify rows or columns; do not use tables merely to position page content.

Avoid semantic overuse

Semantic elements are not decorative wrappers. Do not choose article just because a box looks like a card, or nav for a group of unrelated links. If no specific semantic element fits, a div is appropriate. The goal is meaningful structure, not eliminating every generic element.

Test the result

Inspect the page with browser accessibility tools, navigate using a keyboard, and check headings and landmarks with a screen reader or accessibility tree. Confirm that controls have understandable names and that focus order follows the visual and logical reading order.

Conclusion

Semantic HTML creates a stronger foundation for accessible, understandable websites. Start with the meaning of each content region, use native controls, and let CSS handle visual presentation.

]]>