HTML Cheat Sheet
HTML Cheat Sheet
Open Compiler
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Webpage's Page Title</title>
</head>
<body>
<!-- Webpage's content goes here -->
</body>
</html>
Advertisement
-
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 1/23
Page 2 of 23
Heading Tags
The following are the six HTML heading tags, where <h1> is the main heading of the
webpage and <h6> is the least heading with the smallest size:
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 2/23
Page 3 of 23
<h6>Heading 6</h6>
Paragraph
The <p> tag is used to place content in a paragraph.
Open Compiler
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam facilisis
mattis nisi, at facilisis nunc tempus sed. Duis sagittis odio ac neque tempor
iaculis. Fusce et arcu consequat, pretium lectus ut, venenatis leo. Phasellus
libero enim, semper ut luctus a, pretium in turpis. Donec eget ultricies arcu,
et suscipit nisi. Ut et neque posuere, lacinia dui vitae, varius tellus.
Mauris placerat, leo sed pretium viverra, massa ante ultricies orci, quis
vehicula ex elit et ligula. Nullam ac lectus semper, aliquet neque sit amet,
cursus urna. Aenean faucibus dignissim orci sed malesuada. Maecenas arcu erat,
aliquam eget lacus non, malesuada consectetur tellus. Fusce non eros et dui
ultrices consequat. Vivamus rutrum lobortis purus, ut cursus massa malesuada
vel.</p>
<p>Morbi sollicitudin luctus velit, eget maximus ex accumsan at. Sed interdum
felis a erat tempor, et hendrerit sapien lacinia. Maecenas imperdiet lacinia
ante ut congue. Vestibulum vehicula vulputate dolor non hendrerit.</p>
1. <b>
Open Compiler
2. <i>
Open Compiler
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 3/23
Page 4 of 23
3. <u>
Open Compiler
4. <strong>
Open Compiler
5. <em>
Open Compiler
5. <sub>
Open Compiler
<p>H<sub>2</sub>O</p>
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 4/23
Page 5 of 23
6. <sup>
Open Compiler
<p>x<sup>2</sup> (x squared)</p>
7. <strike>
Open Compiler
8. <mark>
Open Compiler
Listing Tags
HTML provides two tags for listing <ul> and <ol>. The <ul> tag displays an unordered
listing (shows bullets), and the <ol> tag displays an ordered listing (shows numbers).
Unordered Listing
The <ul> tag defines an unordered listing, which shows bullets with list items.
Open Compiler
<ul>
<li>List Item 1</li>
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 5/23
Page 6 of 23
Ordered Listing
The <ol> tag defines an ordered listing, which shows numbers with list items.
Open Compiler
<ol>
<li>List Item 1</li>
<li>List Item 2</li>
<li>List Item 3</li>
</ol>
title: It is used to place the text that you want to see on the mouse over the link.
target: It is used to define where you want to open the link (in the same tab, or in
the new tab).
Open Compiler
Container Tags
HTML container tags are used as the parent element to contain the other HTML tags.
These tags are used to define multiple sections on the webpage.
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 6/23
Page 7 of 23
There are many container tags, such as <div>, <span>, <p>, etc.
<div> Tag
The <div> tag defines the division (or blocks) on the webpage.
Open Compiler
<div>
<p>Paragraph inside div</p>
<ul>
<li>Item 1</li>
<li>Item 1</li>
</ul>
</div>
<span> Tag
The <span> tag may contain various elements in it. Whenever you want to apply specific
styles to a part of the text, you can use it.
Open Compiler
<p> Tag
The <p> tag can also be used as a container tag, where you can use other tags such as
<span>, <a>, <button>, etc.
Open Compiler
<pre> Tag
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 7/23
Page 8 of 23
The <pre> tag is used for preserving formatting and can also be used to display
programming code on the webpage.
Open Compiler
<pre>
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
Hello World
</pre>
<code> Tag
Open Compiler
<code>#include <stdio.h></code>
Images
The <img> tag inserts an image on the webpage. The following are the attributes of the
<img> tag:
title: It defines the title that shows on the mouse over on the image.
Open Compiler
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 8/23
Page 9 of 23
Tables
The HTML <table> tag is used to display data in a tabular format. The following tags are
used with the <table> tag:
<th>: It defines a table cell (known as a table head) inside a <tr> tag.
<td>: It defines a table cell (known as table data) inside a <tr> tag.
Table Structure
The table structure is as follows:
Open Compiler
<table>
<caption>Table Structure</caption>
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
</thead>
<tbody>
<tr>
<td>Data 1</td>
<td>Data 2</td>
<td>Data 3</td>
</tr>
<tr>
<td>Data 4</td>
<td>Data 5</td>
<td>Data 6</td>
</tr>
</tbody>
</table>
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 9/23
Page 10 of 23
It defines the
bgcolor background color of the <table bgcolor="#f0f0f0"> Deprecated
table.
Open Compiler
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 10/23
Page 11 of 23
<blockquote>
Education is the most powerful weapon which you can use to change the world.
</blockquote>
2. <q> Tag
The <q> tag is used to define a short quotation.
Open Compiler
3.<abbr> Tag
The <abbr> tag is used to define an abbreviation or an acronym.
Open Compiler
4. <address> Tag
The <address> tag is used to define the contact information.
Open Compiler
<address>
Written by SUDHIR SHARMA.<br>
Visit us at:<br>
tutorialspoint.com<br>
Madhapur, Hyderabad<br>
India
</address>
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 11/23
Page 12 of 23
5. <bdo> Tag
The <bdo> tag is used to override the current text direction
Open Compiler
Comments
Place the comment in an HTML document by using <!-- and -->.
Open Compiler
<!--This is comment-->
Entities
1. Character Entities
HTML character entities can be used with the & (ampersand) sign.
Open Compiler
2. Non-breaking Space
Use the entity to display non-breaking space.
Open Compiler
<p>ABC XYZ</p>
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 12/23
Page 13 of 23
Open Compiler
Lists
Basic Tags
The following are the basic and required tags for an HTML document:
<body>..
Sets off the visible portion of the document. Try It
</body>
Body Attributes
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 13/23
Page 14 of 23
The body section is the main part of any website, as we all know. There are a few
attributes that can be applied to the <body> tag. It is highly recommended that these
attributes not be used to develop an actual website but only be used in email
newsletters.
Text Tags
The following are the different text tags to make the text look beautiful and readable:
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 14/23
Page 15 of 23
Links
HTML links, also known as hyperlinks, are a fundamental feature of the World Wide Web.
They allow users to navigate between different web pages, websites, or different sections
of the same document.
Creates a hyperlink to
<a href="URL">clickable text</a> a Uniform Resource Try It
Locator.
Creates a hyperlink to
<a href="mailto:email_address">clickable
a specified email Try It
text</a>
address.
Creates a target
<a name="NAME"> location within a Try It
document
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 15/23
Page 16 of 23
Lists
In HTML, lists are used to group a set of related items. There are three main types of
lists: ordered lists, unordered lists, and description lists. Each serves a different
purpose and is marked up with specific HTML tags.
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 16/23
Page 17 of 23
<img src="URL"
Adds image, it is a separate file located at the URL. Try It
/>
<img src="URL" Sets the size of the border surrounding the image
Try It
border=""> (use CSS).
<img src="URL" Sets the alternate text for browsers that can't
Try It
alt=""> process images (required by the ADA).
Forms
HTML forms are one of the most important components of web development. The
following table contains the common tags and attributes related to designing forms in
HTML:
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 17/23
Page 18 of 23
<textarea name=""
Creates a text box area. Columns set
cols="x" rows="y"> Try It
the width, rows set the height.
</textarea>
<input type="checkbox"
Creates a checkbox which is pre-
name="" value="" Try It
checked for certain values.
checked>
<input type="radio"
Creates a radio button which is pre-
name="" value="" Try It
checked.
checked>
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 18/23
Page 19 of 23
Tables
Tables are used to render the data in a structured form. Use tables for data layout and
CSS for page layout.
Table Attributes
Sometimes a normal table is not enough to represent the data we want to render. So,
some attributes are required to be used on table elements so that the table looks good.
Use these attributes for email newsletters, and to decorate a table, use CSS for better
results.
<table
Sets the width of the border around table cells. Try It
border="">
<table
Defines amount of space between table cells. Try It
cellspacing="">
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 19/23
Page 20 of 23
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 20/23
Page 21 of 23
TOP TUTORIALS
Python Tutorial
Java Tutorial
C++ Tutorial
C Programming Tutorial
C# Tutorial
PHP Tutorial
R Tutorial
HTML Tutorial
CSS Tutorial
JavaScript Tutorial
SQL Tutorial
TRENDING TECHNOLOGIES
Git Tutorial
Kubernetes Tutorial
DSA Tutorial
Spring Boot Tutorial
SDLC Tutorial
Unix Tutorial
CERTIFICATIONS
https://www.tutorialspoint.com/html/html_cheat_sheet.htm 21/23