HTML Cheat Sheet & Quick Reference
HTML Cheat Sheet & Quick Reference
This HTML quick reference cheat sheet lists the common HTML and HTML5 tags in readable layout.
# Getting Started
hello.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>HTML5 Boilerplate</title>
</head>
<body>
<h1>Hello world, hello QuickRef.ME!</h1>
</body>
</html>
Comment
Paragraph
HTML link
<a href="https://quickref.me">QuickRef</a>
<a href="mailto:[email protected]">Email</a>
<a href="tel:+12345678">Call</a>
<a href="sms:+12345678&body=ha%20ha">Msg</a>
Image Tag
<b>Bold Text</b>
<strong>This text is important</strong>
<i>Italic Text</i>
<em>This text is emphasized</em>
<u>Underline Text</u>
<pre>Pre-formatted Text</pre>
<code>Source code</code>
<del>Deleted text</del>
<mark>Highlighted text (HTML5)</mark>
<ins>Inserted text</ins>
<sup>Makes text superscripted</sup>
<sub>Makes text subscripted</sub>
<small>Makes text smaller</small>
<kbd>Ctrl</kbd>
<blockquote>Text Block Quote</blockquote>
Headings
Section Divisions
These are the tags used to divide your page up into sections
Inline Frame
↓ Preview
See: The Inline Frame element
JavaScript in HTML
<script type="text/javascript">
let text = "Hello QuickRef.ME";
alert(text);
</script>
External JavaScript
<body>
...
<script src="app.js"></script>
</body>
CSS in HTML
<style type="text/css">
h1 {
color: purple;
}
External stylesheet
<head>
...
<link rel="stylesheet" href="style.css"/>
</head>
# HTML5 Tags
Document
<body>
<header>
<nav>...</nav>
</header>
<main>
<h1>QuickRef.ME</h1>
</main>
<footer>
<p>©2023 QuickRef.ME</p>
</footer>
</body>
Header Navigation
<header>
<nav>
<ul>
<li><a href="#">Edit Page</a></li>
<li><a href="#">Twitter</a></li>
<li><a href="#">Facebook</a></li>
</ul>
</nav>
HTML5 Tags
↓ Preview
HTML5 Audio
<audio controls
src="https://interactive-examples.mdn.mozilla.net/media/cc0-audio/t-rex-roar.mp3">
Your browser does not support the audio element.
</audio>
↓ Preview
HTML5 Ruby
<ruby>
汉 <rp>(</rp><rt>hàn</rt><rp>)</rp>
字 <rp>(</rp><rt>zì</rt><rp>)</rp>
</ruby>
↓ Preview
hà ì
HTML5 kdi
<ul>
<li>User <bdi>hrefs</bdi>: 60 points</li>
<li>User <bdi>jdoe</bdi>: 80 points</li>
<li>User <bdi><إيان/bdi>: 90 points</li>
</ul>
↓ Preview
HTML5 progress
HTML5 mark
I Love QuickRef.ME
# HTML Tables
Table Example
<table>
<thead>
<tr>
<td>name</td>
<td>age</td>
</tr>
</thead>
<tbody>
<tr>
<td>Roberta</td>
<td>39</td>
</tr>
<tr>
<td>Oliver</td>
<td>25</td>
</tr>
</tbody>
</table>
<td> Attributes
See: td#Attributes
<th> Attributes
colspan Number of columns a cell should span
See: th#Attributes
# HTML Lists
Unordered list
<ul>
<li>I'm an item</li>
<li>I'm another item</li>
<li>I'm another item</li>
</ul>
Ordered list
<ol>
<li>I'm the first item</li>
<li>I'm the second item</li>
<li>I'm the third item</li>
</ol>
Definition list
<dl>
<dt>A Term</dt>
<dd>Definition of a term</dd>
<dt>Another Term</dt>
<dd>Definition of another term</dd>
</dl>
# HTML Forms
Form tags
Email:
Password:
Login
Remember me
The HTML <form> element is used to collect and send information to an external source.
Form Attribute
Label tags
<!-- Nested label -->
<label>Click me
<input type="text" id="user" name="name"/>
</label>
Input tags
<label for="Name">Name:</label>
<input type="text" name="Name" id="">
↓ Preview
Username:
Textarea tags
Radio Buttons
Male Female
Radio buttons are used to let the user select exactly one
Checkboxes
Soccer Baseball
Select tags
<label for="city">City:</label>
<select name="city" id="city">
<option value="1">Sydney</option>
<option value="2">Melbourne</option>
<option value="3">Cromwell</option>
</select>
↓ Preview
City: Sydney
Fieldset tags
<fieldset>
<legend>Your favorite monster</legend>
<input type="radio" id="kra" name="m">
<label for="kraken">Kraken</label><br/>
<input type="radio" id="sas" name="m">
<label for="sas">Sasquatch</label>
</fieldset>
↓ Preview
Kraken
Sasquatch
Datalist tags(HTML5)
<label for="b">Choose a browser: </label>
<input list="list" id="b" name="browser"/>
<datalist id="list">
<option value="Chrome">
<option value="Firefox">
<option value="Internet Explorer">
<option value="Opera">
<option value="Safari">
<option value="Microsoft Edge">
</datalist>
↓ Preview
Choose a browser:
The input tag is an empty element, identifying the particular type of field information to obtain from a user.
autofocus Be focused
Input types
type="checkbox"
type="radio"
type="hidden"
type="text"
type="password"
type="image"
type="reset" Reset
type="button" Button
type="submit" Submit
type="color"
type="date" mm/dd/yyyy
type="time" --:-- --
type="email"
type="tel"
type="url"
type="number"
type="search"
type="range"
Input CSS selectors
The meta tag describes meta data within an HTML document. It explains additional material about the HTML.
<meta charset="utf-8">
<!-- ua -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
Open Graph
Twitter Cards
<meta name="twitter:card" content="summary">
<meta name="twitter:site" content="@FechinLi">
<meta name="twitter:title" content="HTML cheatsheet">
<meta name="twitter:url" content="https://quickref.me/html">
<meta name="twitter:description" content="Description of this page">
<meta name="twitter:image" content="https://xxx.com/image.jpg">
Geotagging
See: Geotagging