Getting Started
hello.html
Copy <!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
Copy <!-- this is a comment -->
<!--
Or you can comment out a
large number of lines.
-->
Paragraph
Copy <p>I'm from QuickRef.ME</p>
<p>Share quick reference cheat sheet.</p>
HTML link
Copy <a href="https://quickref.me">QuickRef</a>
<a href="mailto:jack@abc.com">Email</a>
<a href="tel:+12345678">Call</a>
<a href="sms:+12345678&body=ha%20ha">Msg</a>
The URL that the hyperlink points to
Relationship of the linked URL
Link target location:
_self
, _blank
, _top
, _parent
Image Tag
Copy <img loading="lazy" src="https://xxx.png" alt="Describe image here" width="400" height="400">
Required, Image location (URL | Path)
How the browser should load
Text Formatting Tags
Copy <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
Copy <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
Division or Section of Page Content
Section of text within other content
These are the tags used to divide your page up into sections
Inline Frame
Copy <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>
↓ Preview
JavaScript in HTML
Copy <script type="text/javascript">
let text = "Hello QuickRef.ME";
alert(text);
</script>
External JavaScript
Copy <body>
...
<script src="app.js"></script>
</body>
CSS in HTML
Copy <style type="text/css">
h1 {
color: purple;
}
</style>
External stylesheet
Copy <head>
...
<link rel="stylesheet" href="style.css"/>
</head>
Document
Copy <body>
<header>
<nav>...</nav>
</header>
<main>
<h1>QuickRef.ME</h1>
</main>
<footer>
<p>©2023 QuickRef.ME</p>
</footer>
</body>
Copy <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>
Content that’s independent
Embeds a sound, or an audio stream
The Bidirectional Isolate element
Draw graphics via JavaScript
A set of pre-defined options
A dialog box or sub-window
Embeds external application
A caption or legend for a figure
Footer or least important
Masthead or important information
The main content of the document
A scalar value within a known range
A section of navigation links
The result of a calculation
A container for multiple image sources
The completion progress of a task
Provides fall-back parenthesis
Defines the pronunciation of character
Represents a ruby annotation
A group in a series of related content
Resources for the media elements
A summary for the <details> element
Defines the fragments of HTML
Text tracks for the media elements
HTML5 Video
Copy <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>
↓ Preview
HTML5 Audio
Copy <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
Copy <ruby>
汉 <rp>(</rp><rt>hàn</rt><rp>)</rp>
字 <rp>(</rp><rt>zì</rt><rp>)</rp>
</ruby>
↓ Preview
汉hàn字zì
HTML5 kdi
Copy <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
Copy <progress value="50" max="100"></progress>
HTML5 mark
Copy <p>I Love <mark>QuickRef.ME</mark></p>
I Love QuickRef.ME
HTML Tables
Table Example
Copy <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>
Defines a header cell in a table
Defines a cell in a table
Defines a group of columns
Defines a column within a table
Groups the header content
Groups the footer content
<td> Attributes
Number of columns a cell should span
One or more header cells a cell is related to
Number of rows a cell should span
<th> Attributes
Number of columns a cell should span
One or more header cells a cell is related to
Number of rows a cell should span
Description of the cell's content
The header element relates to
HTML Lists
Unordered list
Copy <ul>
<li>I'm an item</li>
<li>I'm another item</li>
<li>I'm another item</li>
</ul>
Ordered list
Copy <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
Copy <dl>
<dt>A Term</dt>
<dd>Definition of a term</dd>
<dt>Another Term</dt>
<dd>Definition of another term</dd>
</dl>
Copy <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.
Name of form for scripting
HTTP method, POST
/ GET
(default)
Runs when the form was submit
Runs when the form was reset
Copy <!-- Nested label -->
<label>Click me
<input type="text" id="user" name="name"/>
</label>
Copy <!-- '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
Copy <label for="Name">Name:</label>
<input type="text" name="Name" id="">
↓ Preview
Username:
Textarea tags
Copy <textarea rows="2" cols="30" name="address" id="address"></textarea>
↓ Preview
Textarea is a multiple-line text input control
Copy <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
Checkboxes
Copy <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
Copy <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
Copy <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
Copy <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:
Copy <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
The input tag is an empty element, identifying the particular type of field information to obtain from a user.
Copy <input type="text" name="?" value="?" minlength="6" required />
The type of data that is being input
Used to describe this data in the HTTP request
Unique identifier that other HTML elements
Stops the user from modifying
The radio or checkbox select or not
Disable auto capitalization
Maximum number of characters
Minimum number of characters
Minimum numerical value on range & number
Maximum numerical value on range & number
How the number will increment in range & number
New Input Types in HTML5
When its keyboard focused
See: Input pseudo classes
The meta tag describes meta data within an HTML document. It explains additional material about the HTML.
Copy <meta charset="utf-8">
Copy <!-- title -->
<title>···</title>
<meta property="og:title" content="···">
<meta name="twitter:title" content="···">
Copy <!-- url -->
<link rel="canonical" href="https://···">
<meta property="og:url" content="https://···">
<meta name="twitter:url" content="https://···">
Copy <!-- description -->
<meta name="description" content="···">
<meta property="og:description" content="···">
<meta name="twitter:description" content="···">
Copy <!-- image -->
<meta property="og:image" content="https://···">
<meta name="twitter:image" content="https://···">
Copy <!-- ua -->
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
Copy <!-- viewport -->
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="width=1024">
Open Graph
Copy <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.
Copy <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
Copy <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">