HTML, colors, ASCII and HTTP

HTML Codes Reference

A compact guide to the HTML elements and entities used most often in everyday web publishing.

Common HTML tags

HTML works best when the markup describes the meaning of the content. Use headings for structure, lists for grouped items, tables for data and form elements for input.

HTML codePurposeWhen to use it
<!DOCTYPE html>Document declarationTells the browser to render the page as modern HTML.
<html>Root elementWraps the complete HTML document and can define the page language.
<head>Metadata containerHolds the title, meta description, canonical URL, CSS links and scripts.
<title>Page titleShown in browser tabs and used as an important search result signal.
<meta>MetadataDefines character encoding, viewport behavior, descriptions and social sharing data.
<link>External resourceConnects stylesheets, icons, canonical URLs and alternate language versions.
<body>Visible page bodyContains the content people and search engines read.
<header>Introductory contentGroups the logo, page heading or primary navigation.
<nav>NavigationMarks a group of important site or page links.
<main>Main contentIdentifies the unique central content of the page.
<section>SectionGroups related content with its own heading.
<article>ArticleRepresents a self-contained article, guide, listing or post.
<aside>Complementary contentHolds related links, notes, sidebars or supporting references.
<footer>FooterContains closing navigation, copyright and related information.
<h1> to <h6>HeadingsCreate a meaningful document outline from the main title down to subsections.
<p>ParagraphWraps blocks of text.
<a>Anchor linkLinks to another page, file, email address or page fragment.
<img>ImageEmbeds an image and should include useful alternative text when meaningful.
<ul>Unordered listCreates a bulleted list.
<ol>Ordered listCreates a numbered list.
<li>List itemRepresents one item inside a list.
<table>TableDisplays structured rows and columns of data.
<thead>Table headGroups header rows in a table.
<tbody>Table bodyGroups the main rows in a table.
<tr>Table rowCreates a row in a table.
<th>Table header cellLabels a row or column.
<td>Table data cellContains one table value.
<form>FormCollects user input for submission or client-side processing.
<label>LabelNames a form control and improves accessibility.
<input>Input controlCreates text, email, checkbox, radio, file and many other controls.
<textarea>Multiline inputAccepts longer free-form text.
<select>Select menuLets a user choose from predefined options.
<button>ButtonTriggers a form action or scripted behavior.
<strong>Strong importanceMarks important text.
<em>EmphasisMarks emphasized text.
<code>CodeRepresents code, file names, tags or commands.
<pre>Preformatted textPreserves whitespace for code blocks or fixed-width text.
<blockquote>QuotationMarks a longer quoted passage.
<figure>FigureGroups media, code or diagrams with an optional caption.
<figcaption>CaptionProvides a caption for a figure.
<script>ScriptLoads or embeds JavaScript.
<style>Embedded CSSAdds CSS directly in a document.
<noscript>No-script fallbackShows content when scripts are unavailable.

HTML entities

Entities help publish reserved characters safely. They are especially useful when showing code examples, symbols or characters that could otherwise be interpreted as markup.

EntityRenders asDescription
&lt;<Less-than sign
&gt;>Greater-than sign
&amp;&Ampersand
&quot;"Quotation mark
&apos;'Apostrophe
&nbsp;non-breaking spaceKeeps adjacent words or values together
&copy;©Copyright sign
&reg;®Registered trademark sign
&trade;Trademark sign
&euro;Euro sign
&pound;£Pound sign
&yen;¥Yen sign