Fictional example page. Riverside Coding Club is not a real group.

HTML Cheat Sheet: 30 Tags You Will Actually Use

Riverside Coding Club ยท Week 1 handout. Each card shows the tag, what it is for, the code, and what the code looks like in a browser.

30 tags

Page structure

<html>

Wraps the whole page. Set the language here.

<!doctype html>
<html lang="en"> ... </html>
Not shown on screen. It holds everything else.

<head>

Holds the title, meta tags and styles. Nothing here shows in the page.

<head>
  <title>Club handout</title>
</head>
Not shown on screen.

<title>

The text on the browser tab and in search results.

<title>HTML Cheat Sheet</title>
Shows on the tab, not in the page.

<meta>

Page settings. The viewport line makes phones use the real screen width.

<meta charset="utf-8">
<meta name="viewport"
  content="width=device-width,initial-scale=1">
Not shown on screen.

<body>

Everything a visitor sees goes inside body.

<body>
  <p>Hello</p>
</body>
Hello

<header>

The top part of a page or a section: logo, title, menu.

<header>
  <strong>Riverside Coding Club</strong>
</header>
Riverside Coding Club

<main>

The main content. Use one per page.

<main>
  <p>This week: lists.</p>
</main>
This week: lists.

<footer>

The bottom part: contact, dates, small print.

<footer>
  <small>Updated Week 1</small>
</footer>
Updated Week 1

Text

<h1> to <h6>

Headings. One h1 for the page title, then h2, h3 in order.

<h1>Club night</h1>
<h2>What to bring</h2>

Club night

What to bring

<p>

A paragraph. The browser adds space above and below.

<p>Bring a laptop.</p>

Bring a laptop.

<strong>

Important text. Shows bold.

<strong>Doors close at 6:15.</strong>
Doors close at 6:15.

<em>

Stress on a word. Shows italic.

Save the file <em>before</em> you close it.
Save the file before you close it.

<br>

A line break inside one block, like an address. No closing tag.

12 River Road<br>Room 4
12 River Road
Room 4

<span>

Marks a few words so you can style them. Means nothing on its own.

Status: <span style="color:green">open</span>
Status: open

<blockquote>

A quote taken from somewhere else.

<blockquote>Start small.</blockquote>
Start small.

<code>

Code inside a sentence. Wrap it in pre for a block that keeps spaces.

Type <code>&lt;p&gt;</code> to start.
Type <p> to start.

Lists and tables

<ul> and <li>

A bullet list. Each item is an li.

<ul>
  <li>Laptop</li>
  <li>Charger</li>
</ul>
  • Laptop
  • Charger

<ol>

A numbered list, for steps in order.

<ol>
  <li>Open the editor</li>
  <li>Save as index.html</li>
</ol>
  1. Open the editor
  2. Save as index.html

<table>

Rows (tr) of cells (td). Use th for header cells.

<table>
  <tr><th>Week</th><th>Topic</th></tr>
  <tr><td>1</td><td>Tags</td></tr>
</table>
WeekTopic
1Tags

<details>

A box that opens on click. No JavaScript needed.

<details>
  <summary>Answer</summary>
  Use an ol.
</details>
AnswerUse an ol.

<div>

A plain box for layout. Use a meaning tag first if one fits.

<div style="padding:8px;
  background:#eef">Note</div>
Note

Forms

<form>

Groups inputs. action is where answers are sent. A plain page has nowhere to send them.

<form action="/signup"> ... </form>
A wrapper. Needs a server to receive answers.

<label>

Names an input. Clicking the label focuses the box.

<label for="nm">Name</label>
<input id="nm">

<input>

One field. type changes it: text, email, date, checkbox.

<input type="checkbox" id="ok">
<label for="ok">I'll be there</label>

<button>

A clickable button. Inside a form it submits by default.

<button type="button">Show hint</button>

<select>

A drop-down list of options.

<select>
  <option>Beginner</option>
  <option>Some HTML</option>
</select>

No tag matches that filter.