# HTML Cheat Sheet: Every Element You Need, by Purpose

> HTML cheat sheet with every current element grouped by purpose: document, text, links, media, lists, tables, forms, layout and interactive, with examples.

Author: [Marko Denic](https://markodenic.com/) | Published: 2026-11-26 | Updated: 2026-11-26 | Topics: HTML, Web Development | Canonical: https://markodenic.com/html-cheat-sheet/

![HTML Cheat Sheet: Every Element You Need, by Purpose](https://markodenic.com/wp-content/uploads/2026/11/og-html-cheat-sheet.png)

**Short answer:** this is a one-page reference of the HTML elements you actually use, grouped by purpose: document, text, links and media, lists, tables, forms, semantic layout and interactive elements. Each one has a one-line description and a minimal example.

Only current elements are listed, checked against the HTML Living Standard. Old tags like `<center>` and `<font>` are left out; there’s a list of them and their replacements at the end.

### Basic HTML page template

Start every page with this. The `charset` declaration has to be in the first 1024 bytes of the file, so put it first in `<head>`, and the viewport line makes the page render properly on phones.

```html
<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Page title</title>
  <meta name="description" content="One sentence about the page.">
  <link rel="stylesheet" href="styles.css">
</head>
<body>
  <header>
    <nav><a href="/">Home</a></nav>
  </header>
  <main>
    <h1>Page title</h1>
    <p>Content.</p>
  </main>
  <footer>© 2026</footer>
  <script src="app.js" defer></script>
</body>
</html>
```

## Document and metadata

The skeleton every page needs. Everything in `<head>` is information about the page; everything in `<body>` is the page.

| Element | Use it for | Example |
| --- | --- | --- |
| `<!doctype html>` | Puts the browser in standards mode. First line of every page. | `<!doctype html>` |
| `<html>` | Root element. Set the page language here. | `<html lang="en">` |
| `<head>` | Container for metadata. | `<head>...</head>` |
| `<title>` | Page title for the tab and search results. | `<title>Pricing</title>` |
| `<meta>` | Charset, viewport, description. | `<meta charset="utf-8">` |
| `<link>` | Stylesheets, icons, canonical URL. | `<link rel="stylesheet" href="app.css">` |
| `<style>` | CSS inside the page. | `<style>p { margin: 0; }</style>` |
| `<script>` | JavaScript, inline or from a file. | `<script src="app.js" defer></script>` |
| `<noscript>` | Content shown when scripting is off. | `<noscript>Enable JavaScript.</noscript>` |
| `<base>` | Base URL for all relative links. Rarely needed. | `<base href="https://markodenic.com/docs/">` |
| `<body>` | The visible content. | `<body>...</body>` |

## Text

Headings and paragraphs give the page its outline; the inline elements add meaning to words inside them.

| Element | Use it for | Example |
| --- | --- | --- |
| `<h1> to <h6>` | Headings. One h1 per page, don’t skip levels. | `<h2>Features</h2>` |
| `<p>` | Paragraph. | `<p>Hello.</p>` |
| `<br>` | Line break inside text, e.g. an address. | `Line one<br>Line two` |
| `<hr>` | Thematic break between sections. | `<hr>` |
| `<strong>` | Important text (bold by default). | `<strong>Warning:</strong>` |
| `<em>` | Stress emphasis (italic by default). | `I <em>said</em> no.` |
| `<b>` | Draws attention without extra importance. | `<b>Keywords</b>` |
| `<i>` | Alternate voice: terms, foreign words. | `<i lang="fr">déjà vu</i>` |
| `<mark>` | Highlighted text. | `<mark>match</mark>` |
| `<small>` | Side comments, fine print. | `<small>Terms apply.</small>` |
| `<s>` | Text that’s no longer accurate. | `<s>$49</s> $29` |
| `<del> / <ins>` | Removed and added text in an edit. | `<del>old</del> <ins>new</ins>` |
| `<sub> / <sup>` | Subscript and superscript. | `H<sub>2</sub>O, x<sup>2</sup>` |
| `<code>` | Inline code. | `<code>npm install</code>` |
| `<pre>` | Preformatted text, keeps whitespace. | `<pre><code>...</code></pre>` |
| `<kbd>` | Keyboard input. | `<kbd>Ctrl</kbd> + <kbd>C</kbd>` |
| `<blockquote>` | Quoted block from another source. | `<blockquote><p>Quote</p></blockquote>` |
| `<q>` | Short inline quote; adds quote marks. | `<q>Ship it</q>` |
| `<cite>` | Title of a work. | `<cite>The Pragmatic Programmer</cite>` |
| `<abbr>` | Abbreviation, with the expansion in title. | `<abbr title="HyperText Markup Language">HTML</abbr>` |
| `<time>` | Date or time, machine-readable. | `<time datetime="2026-11-12">Nov 12</time>` |
| `<span>` | Generic inline container for styling. | `<span class="price">$29</span>` |
| `<wbr>` | Optional line-break point in long words. | `very<wbr>long<wbr>word` |

## Links and media

Links, images, video and embeds. Always give images an `alt` and set `width` and `height` to avoid layout shift.

| Element | Use it for | Example |
| --- | --- | --- |
| `<a>` | Link to a page, file, email or section. | `<a href="https://markodenic.com/about/">About</a>` |
| `<img>` | Image. | `<img src="cat.jpg" alt="A cat" width="600" height="400">` |
| `<picture>` | Different image sources per format or screen. | `<picture><source srcset="cat.avif" type="image/avif"><img src="cat.jpg" alt="A cat"></picture>` |
| `<source>` | Alternative source for picture, video, audio. | `<source src="clip.webm" type="video/webm">` |
| `<video>` | Video player. | `<video src="clip.mp4" controls></video>` |
| `<audio>` | Audio player. | `<audio src="talk.mp3" controls></audio>` |
| `<track>` | Captions or subtitles for video. | `<track kind="captions" src="en.vtt" srclang="en">` |
| `<iframe>` | Embed another page. | `<iframe src="map.html" title="Map"></iframe>` |
| `<figure> / <figcaption>` | Self-contained media with a caption. | `<figure><img ...><figcaption>Fig. 1</figcaption></figure>` |
| `<svg>` | Inline vector graphics. | `<svg viewBox="0 0 24 24">...</svg>` |
| `<canvas>` | Drawing surface for JavaScript. | `<canvas width="300" height="150"></canvas>` |

## Lists

| Element | Use it for | Example |
| --- | --- | --- |
| `<ul>` | Bullet list; order doesn’t matter. | `<ul><li>Milk</li></ul>` |
| `<ol>` | Numbered list; order matters. | `<ol start="3"><li>Step</li></ol>` |
| `<li>` | List item. | `<li>Item</li>` |
| `<dl> / <dt> / <dd>` | Terms and descriptions. | `<dl><dt>CSS</dt><dd>Styles</dd></dl>` |

Lists are the right element for navigation menus, card grids and any set of similar items.

## Tables

For tabular data only, never for layout.

| Element | Use it for | Example |
| --- | --- | --- |
| `<table>` | Table. | `<table>...</table>` |
| `<caption>` | Table title. | `<caption>Prices</caption>` |
| `<thead> / <tbody> / <tfoot>` | Header, body and footer row groups. | `<thead><tr>...</tr></thead>` |
| `<tr>` | Row. | `<tr><td>1</td></tr>` |
| `<th>` | Header cell. | `<th scope="col">Price</th>` |
| `<td>` | Data cell. | `<td colspan="2">Free</td>` |
| `<colgroup> / <col>` | Style whole columns. | `<colgroup><col span="2"></colgroup>` |

## Forms

Every form control needs a label; a placeholder is not a label.

| Element | Use it for | Example |
| --- | --- | --- |
| `<form>` | Form that submits data. | `<form action="/subscribe" method="post">` |
| `<label>` | Label for a control. | `<label for="email">Email</label>` |
| `<input>` | Text, email, checkbox, date and more. | `<input id="email" type="email" name="email" required>` |
| `<textarea>` | Multi-line text. | `<textarea name="msg" rows="4"></textarea>` |
| `<select> / <option>` | Dropdown list. | `<select name="size"><option>M</option></select>` |
| `<optgroup>` | Group of options. | `<optgroup label="Fruit">...</optgroup>` |
| `<button>` | Button; submits a form by default. | `<button type="submit">Send</button>` |
| `<fieldset> / <legend>` | Group related controls with a caption. | `<fieldset><legend>Shipping</legend>...</fieldset>` |
| `<datalist>` | Suggestions for an input. | `<input list="langs"><datalist id="langs"><option value="HTML"></datalist>` |
| `<output>` | Result of a calculation. | `<output name="total">0</output>` |
| `<progress>` | Task progress. | `<progress value="70" max="100"></progress>` |
| `<meter>` | Value in a known range. | `<meter value="0.6">60%</meter>` |

`<input>` alone has more than 20 types, from `email` to `color` and `date`; each is covered in [HTML input types](https://markodenic.com/html-input-types/).

## Semantic layout

These elements describe what a part of the page is. Screen readers expose `<nav>`, `<main>`, `<search>` and the page-level `<header>` and `<footer>` as landmarks users can jump between.

| Element | Use it for | Example |
| --- | --- | --- |
| `<header>` | Intro of the page or a section: logo, title, nav. | `<header>...</header>` |
| `<nav>` | Main navigation links. | `<nav><a href="https://markodenic.com/">Home</a></nav>` |
| `<main>` | The main content. One visible main per page. | `<main>...</main>` |
| `<article>` | Self-contained content: post, card, comment. | `<article><h2>Title</h2></article>` |
| `<section>` | Thematic group, usually with a heading. | `<section><h2>FAQ</h2></section>` |
| `<aside>` | Related content off the main flow. | `<aside>Related posts</aside>` |
| `<footer>` | Footer of the page or a section. | `<footer>&copy; 2026</footer>` |
| `<address>` | Contact info for the page or article. | `<address><a href="mailto:hi@example.com">hi@example.com</a></address>` |
| `<search>` | Wraps search or filter controls. | `<search><form>...</form></search>` |
| `<div>` | Generic block container when nothing else fits. | `<div class="grid">...</div>` |

`<search>` is the newest element here: Chrome and Firefox support it from version 118, Safari from 17.

## Interactive

Built-in widgets that work without JavaScript, or with very little.

| Element | Use it for | Example |
| --- | --- | --- |
| `<details> / <summary>` | Collapsible section. | `<details><summary>More</summary>Hidden text</details>` |
| `<dialog>` | Dialog box or modal. | `<dialog id="d">Hi <form method="dialog"><button>Close</button></form></dialog>` |
| `<template>` | Markup that isn’t rendered, for cloning with JavaScript. | `<template id="row"><li></li></template>` |

### Semantic page layout example

Here’s how the layout elements fit together on a typical blog post page. A `<div>` is still fine for wrappers you only need for styling.

```html
<body>
  <header>
    <a href="/">Logo</a>
    <nav>
      <ul>
        <li><a href="/blog/">Blog</a></li>
        <li><a href="/about/">About</a></li>
      </ul>
    </nav>
  </header>

  <main>
    <article>
      <h1>Post title</h1>
      <p>Published <time datetime="2026-11-12">November 12, 2026</time></p>
      <section>
        <h2>First section</h2>
        <p>Text.</p>
      </section>
    </article>
    <aside>
      <h2>Related</h2>
    </aside>
  </main>

  <footer>
    <p>© 2026</p>
  </footer>
</body>
```

## Obsolete elements to avoid

The HTML standard marks these as obsolete. Browsers still render some of them, but don’t use them in new code.

| Obsolete | Use instead |
| --- | --- |
| `<center>`, `<font>`, `<big>`, `<tt>` | CSS (or `<code>`, `<kbd>` for `tt`) |
| `<marquee>`, `<blink>` | CSS animation, if anything |
| `<strike>` | `<del>` for edits, `<s>` otherwise |
| `<acronym>` | `<abbr>` |
| `<frame>`, `<frameset>` | `<iframe>` and CSS |
| `<applet>` | `<embed>` or `<object>` |
| `<dir>` | `<ul>` |

For smaller tricks with these elements, like lazy-loading images or native accordions, see [HTML tips](https://markodenic.com/html-tips/). And if you’re wondering whether all of this counts as programming, here’s [whether HTML is a programming language](https://markodenic.com/is-html-a-programming-language/).

## FAQ

### How many HTML elements are there?

The HTML Living Standard’s element index lists a little over 110 elements. This cheat sheet covers the ones you’ll reach for; the rest are niche, like ruby annotations and image maps.

### What’s the difference between strong and b?

`<strong>` marks text as important. `<b>` only draws attention, without extra importance. Both are bold by default.

### When should I use section vs div?

Use `<section>` for a thematic part of the page that has its own heading. Use `<div>` when you only need a box for styling or layout.

### Which HTML tags don’t need a closing tag?

Void elements have no content and no closing tag: `<br>`, `<hr>`, `<img>`, `<input>`, `<meta>`, `<link>`, `<source>`, `<track>`, `<wbr>`, `<col>`, `<area>`, `<base>` and `<embed>`. The trailing slash in `<br />` is allowed but does nothing.
