HTML codes and basics: tags, character entities and a page template

Updated November 2026

HTML is the language of web pages. Browsers read it to decide what is a heading, a paragraph, a link or a table. You can write it in any text editor, and it is worth knowing even if a content system writes most of it for you.

A minimal modern page

<!doctype html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>My first page</title>
  <link rel="stylesheet" href="style.css">
</head>
<body>
  <header><h1>My first page</h1></header>
  <main>
    <p>Hello. This is a <a href="https://www.unixtools.com/">link</a>.</p>
  </main>
  <footer><p>&copy; 2026 Me</p></footer>
</body>
</html>

The viewport line makes the page readable on phones, and charset="utf-8" lets you type any character directly. Leave layout and colours to CSS in a separate file.

The tags you will use most

TagUse
<h1> … <h6>Headings; one h1 per page, then h2 for sections
<p>Paragraph
<a href="…">Link
<img src="…" alt="…">Image; alt describes it for blind users and search engines
<ul>, <ol>, <li>Bulleted list, numbered list, list item
<strong>, <em>Important text, emphasis
<code>, <pre>Code; preformatted block keeping spaces and line breaks
<table>, <tr>, <th>, <td>Table, row, header cell, data cell
<header>, <nav>, <main>, <footer>Page regions
<form>, <label>, <input>, <button>Forms
<br>Line break inside a paragraph (rarely needed)

Older tags such as <font>, <center> and layout tables were replaced by CSS long ago. If you maintain an old site, replace them as you go.

<a href="/security.html">Security guide</a>
<a href="https://example.com/" rel="noopener" target="_blank">Opens in a new tab</a>
<a href="mailto:info@example.com">E-mail us</a>

<img src="logo.png" alt="Company logo" width="200" height="80" loading="lazy">

<ul>
  <li>First</li>
  <li>Second</li>
</ul>

<table>
  <thead><tr><th>Command</th><th>Does</th></tr></thead>
  <tbody><tr><td>ls</td><td>lists files</td></tr></tbody>
</table>

HTML character codes (entities)

Some characters have a special meaning in HTML and must be written as a code. With UTF-8 you can type most other symbols directly, but the codes are useful when your keyboard lacks them.

CharacterNamed codeNumberDescription
<&lt;&#60;Less than; must be escaped in text
>&gt;&#62;Greater than
&&amp;&#38;Ampersand; must be escaped, also in URLs inside attributes
"&quot;&#34;Double quote inside an attribute value
'&apos;&#39;Apostrophe
(space)&nbsp;&#160;Non-breaking space
©&copy;&#169;Copyright
®&reg;&#174;Registered trademark
™&trade;&#8482;Trademark
€&euro;&#8364;Euro
£&pound;&#163;Pound sterling
¥&yen;&#165;Yen
°&deg;&#176;Degree
±&plusmn;&#177;Plus or minus
×&times;&#215;Multiplication
÷&divide;&#247;Division
–&ndash;&#8211;En dash
—&mdash;&#8212;Em dash
…&hellip;&#8230;Ellipsis
« »&laquo; &raquo;&#171; &#187;Angle quotes
“ ”&ldquo; &rdquo;&#8220; &#8221;Curly double quotes
→ ←&rarr; &larr;&#8594; &#8592;Arrows
✓&check;&#10003;Check mark
•&bull;&#8226;Bullet

Any Unicode character can be written by number: decimal &#8364; or hexadecimal &#x20AC; both give €. To escape text in a script before putting it into a page, use htmlspecialchars() in PHP or html.escape() in Python; on the command line, sed -e 's/&/\&amp;/g' -e 's/</\&lt;/g' -e 's/>/\&gt;/g'.

Check your HTML

Serving pages from a Unix server

A static site is just HTML files in a directory. To try one locally, run python3 -m http.server 8000 in that directory and open http://localhost:8000/. For the real thing, see setting up a web server and web hosting basics.

Learn more