- HTML 4.01 Specification (w3.org)
HTML Cheat Sheet
This HTML quick reference cheat sheet lists the common HTML and HTML5 tags in readable layout.
Also see
HTML meta Tags
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
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">
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.
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">
HTML input Tags
Input CSS selectors
input:focus |
When its keyboard focused |
See: Input pseudo classes |
Input types
type="checkbox" |
|
type="radio" |
|
type="file" |
|
type="hidden" |
|
type="text" |
|
type="password" |
|
type="image" |
|
type="reset" |
|
type="button" |
Button |
type="submit" |
#New Input Types in HTML5
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 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 element |
HTML Forms
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>
#â Preview
Name:
Submit
the data to server; Reset
to default values
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:
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
Your favorite monster
Kraken
Sasquatch
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 Melbourne Cromwell A select box is a dropdown list of options
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>
#â Preview
Soccer Baseball Checkboxes allows the user to select one or more
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>
#â Preview
Male Female Radio buttons are used to let the user select exactly one
Textarea tags
<textarea rows="2" cols="30" name="address" id="address"></textarea>
#â Preview
Textarea is a multiple-line text input control
Input tags
<label for="Name">Name:</label>
<input type="text" name="Name" id="">
#â Preview
Username: See: HTML input Tags
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
Form Attribute
Attribute | Description |
---|---|
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 |
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>
#â Preview
Email:
Password:
Remember me
The HTML <form>
element is used to collect and send information to an external source.
HTML Lists
Definition list
<dl>
<dt>A Term</dt>
<dd>Definition of a term</dd>
<dt>Another Term</dt>
<dd>Definition of another term</dd>
</dl>
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>
Unordered list
<ul>
<li>I'm an item</li>
<li>I'm another item</li>
<li>I'm another item</li>
</ul>
HTML Tables
<th> Attributes
Attribute | Description |
---|---|
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 |
<td> Attributes
Attribute | Description |
---|---|
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 |
HTML Table Tags
Tag | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Table Example
HTML5 Tags
HTML5 mark
I Love QuickRef.ME HTML5 progress
HTML5 Ruby
#â Previewæ± (hà n) å (zì) HTML5 Audio
#â PreviewYour browser does not support the audio element. HTML5 Video
#â PreviewSorry, your browser doesn't support embedded videos. Header Navigation
Document
Getting StartedCSS in HTML
#External stylesheet
JavaScript in HTML
#External JavaScript
Inline Frame
#â PreviewSection Divisions
Headings
You should only have one h1 on your page Text Formatting Tags
Image Tag
HTML link
Paragraph
Comment
hello.html
Or try it out in the jsfiddle |