Introduction to HTML5

Introduction to HTML5 in HTML: Before a single story is set in type, a newspaper already has an architecture.

The Analogy: The Architecture of a Printed Newspaper

Before a single story is set in type, a newspaper already has an architecture. A reader who has never seen this particular paper still knows exactly where to look: the nameplate carrying the paper's title runs across the top, a thin index of sections sits just beneath it, the major stories fill the central well, and the small print naming the publisher and the year hides at the very bottom. None of this is decoration. It is a shared, learned structure that lets a stranger navigate a hundred-page broadsheet in seconds. An HTML document is built on the same idea: a fixed skeleton that any browser, search crawler, or screen reader can navigate without being told what this specific page happens to be about.

The paper's outermost declaration is the format itself. A broadsheet is folded and read differently from a tabloid, and the press operators are told which one they are printing before a drop of ink is laid down. The <!DOCTYPE html> line plays that role for the browser: it is not an element and it holds no content, it is a one-line notice, read first, that says "render this the modern, standards-compliant way." Inside that format sits the whole paper, the <html> root, split into two physically distinct regions: the production information readers skim past (<head>) and the printed pages they actually read (<body>).

Within the reading pages, a good paper is never an undivided river of words. It is carved into named regions a reader recognizes on sight: the running header, the section index, the main news well, self-contained stories, themed pages like Business or Sports, boxed sidebars set apart from the main column, and the colophon at the foot. HTML5's semantic elements, <header>, <nav>, <main>, <article>, <section>, <aside>, and <footer>, are exactly these named regions. Using them is what lets an assistive tool offer a reader "jump to the main content" or "list the navigation," the digital equivalent of flipping straight to the Sports section by its printed tab.


Syntax & Core Structure

Every HTML5 document is a nested set of four fixed parts. The declaration comes first, then the root element wraps a metadata region and a content region:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>The Daily Ledger - Enterprise News</title>
  </head>
  <body>
    <header>
      <h1>Front Page</h1>
    </header>
    <main>
      <article>
        <h2>Standards-Compliant Markup</h2>
        <p>All the markup fit to parse.</p>
      </article>
    </main>
  </body>
</html>

A browser does not "run" this document the way it runs a script; it parses the bytes into a tree of nodes called the DOM (Document Object Model).

The lang="en" attribute is not cosmetic; it tells a screen reader which pronunciation rules to apply and search engines which language to index.


Technical Depth: Semantic Landmarks and the Document Outline

A <div> is a generic box with no inherent semantic meaning; a <section>, <article>, or <nav> announces its purpose to both the accessibility tree and search crawlers.

ElementImplicit ARIA RoleSemantic Purpose
<header>bannerPage-level introductory content, logo, branding
<nav>navigationA block of major navigation links
<main>mainThe unique central content of the document (only one per page)
<article>articleA self-contained, independently syndicatable item
<section>regionA thematic grouping with its own heading
<aside>complementaryContent tangential to the main flow (sidebars, callouts)
<footer>contentinfoAuthorship, legal copyright, privacy links

Exercises

  1. Create a minimal valid HTML5 document containing all seven semantic landmark elements.
  2. Inspect the Accessibility Tree in Chrome DevTools to verify that the <main> landmark is correctly exposed.
  3. Explain why wrapping an entire page inside a generic <div id="main"> harms accessibility compared to using the native <main> element.