HTML Quick Dev 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>

Or try it out in the jsfiddle

Comment

<!-- this is a comment -->

<!--
    Or you can comment out a
    large number of lines.
-->

Paragraph

<p>I'm from QuickRef.ME</p>
<p>Share quick reference cheat sheet.</p>

See: The Paragraph element

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>

β€” href β€” The URL that the hyperlink points to

β€” rel β€” Relationship of the linked URL

β€” target β€” Link target location: _self, _blank, _top, _parent

See: The &lt;a&gt; Attributes

Image Tag

<img loading="lazy" src="https://xxx.png" alt="Describe image here" width="400" height="400">

β€” src β€” Required, Image location (URL | Path)

β€” alt β€” Describe of the image

β€” width β€” Width of the image

β€” height β€” Height of the image

β€” loading β€” How the browser should load

See: The Image Embed element

Text Formatting Tags

<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

<h1> This is Heading 1 </h1>
<h2> This is Heading 2 </h2>
<h3> This is Heading 3 </h3>
<h4> This is Heading 4 </h4>
<h5> This is Heading 5 </h5>
<h6> This is Heading 6 </h6>

You should only have one h1 on your page

Section Divisions

<div></div> β€” Division or Section of Page Content

<span></span> β€” Section of text within other content

<p></p> β€” Paragraph of Text

<br> β€” Line Break

<hr> β€” Basic Horizontal Line

These are the tags used to divide your page up into sections

Inline Frame

<iframe title="New York"
    width="342"
    height="306"
    id="gmap_canvas"
    src="https://maps.google.com/maps?q=2880%20Broadway,%20New%20York&t=&z=13&ie=UTF8&iwloc=&output=embed"
    scrolling="no">
</iframe>

See: The Inline Frame element

JavaScript in HTML

<script type="text/javascript">
    let text = "Hello QuickRef.ME";
    alert(text);
</script>

<body>
    ...
    
    <script src="app.js"></script>
</body>

CSS in HTML

<style type="text/css">
    h1 {
        color: purple;
    }
</style>

<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>
</header>

HTML5 Tags

article β€” Content that’s independent

aside β€” Secondary content

audio β€” Embeds a sound, or an audio stream

bdi β€” The Bidirectional Isolate element

canvas β€” Draw graphics via JavaScript

data β€” Machine readable content

datalist β€” A set of pre-defined options

details β€” Additional information

dialog β€” A dialog box or sub-window

embed β€” Embeds external application

figcaption β€” A caption or legend for a figure

figure β€” A figure illustrated

footer β€” Footer or least important

header β€” Masthead or important information

main β€” The main content of the document

mark β€” Text highlighted

meter β€” A scalar value within a known range

nav β€” A section of navigation links

output β€” The result of a calculation

picture β€” A container for multiple image sources

progress β€” The completion progress of a task

rp β€” Provides fall-back parenthesis

rt β€” Defines the pronunciation of character

ruby β€” Represents a ruby annotation

section β€” A group in a series of related content

source β€” Resources for the media elements

summary β€” A summary for the <details> element

template β€” Defines the fragments of HTML

time β€” A time or date

track β€” Text tracks for the media elements

video β€” Embeds video

wbr β€” A line break opportunity

HTML5 Video

<video controls="" width="100%">
    <source src="https://interactive-examples.mdn.mozilla.net/media/cc0-videos/flower.mp4" type="video/mp4">
    Sorry, your browser doesn't support embedded videos.
</video>

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>

Your browser does not support the audio element.

HTML5 Ruby

<ruby>
  汉 <rp>(</rp><rt>hΓ n</rt><rp>)</rp>
  字 <rp>(</rp><rt>zì</rt><rp>)</rp>
</ruby>

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>

User hrefs: 60 points User jdoe: 80 points User Ψ₯ΩŠΨ§Ω†: 90 points

HTML5 progress

<progress value="50" max="100"></progress>

HTML5 mark

<p>I Love <mark>QuickRef.ME</mark></p>

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>

HTML Table Tags

<table> β€” Defines a table

<th> β€” Defines a header cell in a table

<tr> β€” Defines a row in a table

<td> β€” Defines a cell in a table

<caption> β€” Defines a table caption

<colgroup> β€” Defines a group of columns

<col> β€” Defines a column within a table

<thead> β€” Groups the header content

<tbody> β€” Groups the body content

<tfoot> β€” Groups the footer content

<td> Attributes

colspan β€” Number of columns a cell should span

headers β€” One or more header cells a cell is related to

rowspan β€” Number of rows a cell should span

See: td#Attributes

<th> Attributes

colspan β€” Number of columns a cell should span

headers β€” One or more header cells a cell is related to

rowspan β€” Number of rows a cell should span

abbr β€” Description of the cell's content

scope β€” The header element relates to

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>

See: The Unordered List element

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>

See: The Ordered List element

Definition list

<dl>
    <dt>A Term</dt>
    <dd>Definition of a term</dd>
    <dt>Another Term</dt>
    <dd>Definition of another term</dd>
</dl>

See: The Description List element

HTML Forms

Form tags

<form method="POST" action="api/login">
  <label for="mail">Email: </label>
  <input type="email" id="mail" name="mail">
  <br/>
  <label for="pw">Password: </label>
  <input type="password" id="pw" name="pw">
  <br/>
  <input type="submit" value="Login">
  <br/>
  <input type="checkbox" id="ck" name="ck">
  <label for="ck">Remember me</label>
</form>

The HTML &lt;form&gt; element is used to collect and send information to an external source.

Form Attribute

name β€” Name of form for scripting

action β€” URL of form script

method β€” HTTP method, POST / GET (default)

enctype β€” Media type, See enctype

onsubmit β€” Runs when the form was submit

onreset β€” Runs when the form was reset

Label tags

<!-- Nested label -->
<label>Click me 
<input type="text" id="user" name="name"/>
</label>
<!-- 'for' attribute -->
<label for="user">Click me</label>
<input id="user" type="text" name="name"/>

for in a label references an input's id attribute

Input tags

<label for="Name">Name:</label>
<input type="text" name="Name" id="">

See: HTML input Tags

Textarea tags

<textarea rows="2" cols="30" name="address" id="address"></textarea>

Textarea is a multiple-line text input control

Radio Buttons

<input type="radio" name="gender" id="m">
<label for="m">Male</label>
<input type="radio" name="gender" id="f">
<label for="f">Female</label>

Radio buttons are used to let the user select exactly one

Checkboxes

<input type="checkbox" name="s" id="soc">
<label for="soc">Soccer</label>
<input type="checkbox" name="s" id="bas">
<label for="bas">Baseball</label>

Checkboxes allows the user to select one or more

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>

A select box is a dropdown list of options

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>

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>

Submit and Reset Buttons

<form action="register.php" method="post">
  <label for="foo">Name:</label>
  <input type="text" name="name" id="foo">
  <input type="submit" value="Submit">
  <input type="reset" value="Reset">
</form>

Submit the data to server; Reset to default values

HTML input Tags

Input Attributes

The input tag is an empty element, identifying the particular type of field information to obtain from a user.

<input type="text" name="?" value="?" minlength="6"	 required />

β€” type="…" β€” The type of data that is being input

β€” value="…" β€” Default value

β€” name="…" β€” Used to describe this data in the HTTP request

β€” id="…" β€” Unique identifier that other HTML elements

β€” readonly β€” Stops the user from modifying

β€” disabled β€” Stops any interaction

β€” checked β€” The radio or checkbox select or not

β€” required β€” Being compulsory, See required

β€” placeholder="…" β€” Adds a temporary, See ::placeholder

β€” autocomplete="off" β€” Disable auto completion

β€” autocapitalize="none" β€” Disable auto capitalization

β€” inputmode="…" β€” Display a specific keyboard, See inputmode

β€” list="…" β€” The id of an associated datalist

β€” maxlength="…" β€” Maximum number of characters

β€” minlength="…" β€” Minimum number of characters

β€” min="…" β€” Minimum numerical value on range & number

β€” max="…" β€” Maximum numerical value on range & number

β€” step="…" β€” How the number will increment in range & number

β€” pattern="…" β€” Specifies a Regular expression, See pattern

β€” autofocus β€” Be focused

β€” spellcheck β€” Perform spell checking

β€” multiple β€” Whether to allow multiple values

β€” accept="" β€” Expected file type in file upload controls

Also see: Attributes for the &lt;input&gt; element

Input types

type="checkbox" β€”

type="radio" β€”

type="file" β€”

type="hidden" β€”

type="text" β€”

type="password" β€”

type="image" β€”

type="reset" β€”

type="button" β€” Button

type="submit" β€”

type="color" β€”

type="date" β€”

type="time" β€”

type="month" β€”

type="datetime-local" β€”

type="week" β€”

type="email" β€”

type="tel" β€”

type="url" β€”

type="number" β€”

type="search" β€”

type="range" β€”

Input CSS selectors

input:focus β€” When its keyboard focused

See: Input pseudo classes

HTML meta Tags

Meta tags

The meta tag describes meta data within an HTML document. It explains additional material about the HTML.

<meta charset="utf-8">
<!-- title -->
<title>Β·Β·Β·</title>
<meta property="og:title"  content="Β·Β·Β·">
<meta name="twitter:title" content="Β·Β·Β·">
<!-- url -->
<link rel="canonical"       href="https://Β·Β·Β·">
<meta property="og:url"  content="https://Β·Β·Β·">
<meta name="twitter:url" content="https://Β·Β·Β·">
<!-- description -->
<meta name="description"         content="Β·Β·Β·">
<meta property="og:description"  content="Β·Β·Β·">
<meta name="twitter:description" content="Β·Β·Β·">
<!-- image -->
<meta property="og:image"  content="https://Β·Β·Β·">
<meta name="twitter:image" content="https://Β·Β·Β·">
<!-- ua -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<!-- viewport -->
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="width=1024">

Open Graph

<meta property="og:type" content="website">
<meta property="og:locale" content="en_CA">
<meta property="og:title" content="HTML cheatsheet">
<meta property="og:url" content="https://quickref.me/html">
<meta property="og:image" content="https://xxx.com/image.jpg">
<meta property="og:site_name" content="Name of your website">
<meta property="og:description" content="Description of this page">

Used by Facebook, Instagram, Pinterest, LinkedIn, etc.

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">

See: Twitter Card Documentation

Geotagging

<meta name="ICBM" content="45.416667,-75.7">
<meta name="geo.position" content="45.416667;-75.7">
<meta name="geo.region" content="ca-on">
<meta name="geo.placename" content="Ottawa">

See: Geotagging