Skip to main content

Developer reference

HTML Cheatsheet: Semantic Elements, Forms, and Metadata

A production-minded HTML reference organized by purpose, with valid patterns and review checks you can apply while building.

HTMLbeginner4 min readWeb reference

Learning overview

Estimated time
4 minutes
Difficulty
Beginner
Prerequisites
No prior experience required
Learning outcome
Explain html using a clear mental model · Apply html in practical HTML work
Last updated
July 18, 2026

Document foundation

Declare standards mode, language, encoding, viewport behavior, a unique title, and a page-specific description.

document.html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Specific page title</title>
  <meta name="description" content="A concise summary of this page.">
</head>
<body>
  <main>
    <h1>One clear page topic</h1>
  </main>
</body>
</html>

Semantic structure and text

Choose by meaning. Header and footer can belong to a page or section; nav identifies major navigation; main contains unique primary content.

  • header — introductory content
  • nav — major navigation links
  • main — unique primary page content
  • article — independently meaningful content
  • section — a thematic group, usually with a heading
  • aside — complementary content
  • h1–h6 — hierarchical section names
  • p, ul, ol, dl, blockquote, pre, code — text structures

Data tables

Use tables for relationships between row and column headers, not page layout. Caption names the table and scope associates headers with rows or columns.

table.html
<table>
  <caption>Course completion by week</caption>
  <thead>
    <tr><th scope="col">Week</th><th scope="col">Completed</th></tr>
  </thead>
  <tbody>
    <tr><th scope="row">Week 1</th><td>12</td></tr>
  </tbody>
</table>

Accessible forms

Use visible labels, appropriate types, helpful autocomplete tokens, and buttons with explicit intent. Fieldset and legend group related controls.

form.html
<form action="/subscribe" method="post">
  <label for="subscriber-email">Email address</label>
  <input
    id="subscriber-email"
    name="email"
    type="email"
    autocomplete="email"
    required>
  <button type="submit">Subscribe</button>
</form>

Production review checklist

Validation catches syntax errors; human testing confirms whether the structure and interactions make sense.

  • Unique title, description, h1, and canonical for indexable pages
  • Logical headings and landmarks
  • Descriptive link text
  • Visible labels for controls
  • Purposeful alt text and explicit image dimensions
  • Keyboard-operable controls with visible focus
  • No duplicate IDs or invalid nesting
  • No ARIA added where native HTML already supplies the behavior

Frequently asked questions

What HTML elements should beginners memorize first?

Learn the document shell, headings, paragraphs, lists, links, images, landmarks, labels, inputs, buttons, and the table elements. Learn uncommon elements as projects require them.

Can this cheatsheet replace HTML validation?

No. Use it while writing, then run a validator and manually test headings, links, controls, keyboard order, and media alternatives.

Topic graph

A taxonomy-generated path through this subject.

  1. HTML
  2. Web reference
  3. html
  4. reference
  5. semantic-html
  6. accessibility
  7. What Is HTML in Programming?
  8. Learn HTML: From First Page to Semantic Websites
  9. HTML Tutorial: Build a Complete Semantic Web Page

Recommended automatically from shared technologies, topics, intent, and difficulty.

Hand-picked companion pages that deepen this topic.

Your next steps

Continue learning

  1. 1glossaryWhat Is HTML in Programming?
  2. 2guidesLearn HTML: From First Page to Semantic Websites
  3. 3guidesHTML Tutorial: Build a Complete Semantic Web Page
  4. 4cheatsheetsCSS Cheatsheet: Cascade, Layout, Responsive Design