What Is HTML
What Is HTML
HTML is the standard markup language for creating Web pages. HTML is the language of
the web, used by billions of websites to create the pages that we see every day.
HTML stands for HyperText Markup Language. It is the standard language used to create
and design web pages on the internet. It was introduced by Tim Berners-
Lee in 1991 at CERN as a simple markup language. Since then, it has evolved through
versions from HTML 2.0 to HTML5 (the latest 2024 version).
HTML is a combination of Hypertext and Markup language. Hypertext defines the link
between the web pages and Markup language defines the text document within the tag.
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
</body>
</html>
Example Explained
Empty tag: The tags that do not have an end tag, is known as an empty tag. Eg. <hr>, <br>,
<img>. These tags have no effect on the subsequent portion of the document and hence do
not need an ending tag. HTML elements with no content are called empty elements.
<br> is an empty element without a closing tag (the <br> tag defines a line break).
Empty elements can be "closed" in the opening tag like this: <br />.
HTML5 does not require empty elements to be closed. But if you want stricter validation, or
if you need to make your document readable by XML parsers, you must close all HTML
elements properly.
Attributes
Some elements may include attributes, which are the additional information that are included
inside the starting tag (eg. Size, color). An attribute typically consists of an attribute name, an
equal sign and a value. White space is allowed around the equal sign. The value of the
attribute may be either delimited by single quotes or double quotes.
<!DOCTYPE html>
<html>
<head>
<title>Page title</title>
</head>
<body>
</body>
</html>
It must only appear once, at the top of the page (before any HTML tags).
<!DOCTYPE html>
HTML Versions
Since the early days of the web, there have been many versions of HTML:
Version Year
HTML 1991
HTML 2.0 1995
HTML 3.2 1997
HTML 4.01 1999
XHTML 2000
HTML5 2014
Head tag
The <head> tag serves to encapsulate the other header tags. It is placed below the <html> and
above the <body> tag in a document. It may contain some other tags that help to define and
manage the document’s content, such as <tittle> tag.
Tittle tag
Whatever we write inside this tag appears at the top of the browser document window. It is
also used by search engines and for book marks.
Body tag
This tag is used to place all other tags inside it.
The background-color property defines the background color for an HTML element.
Example
<body bgcolor=”blue”>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
HTML Editors
Write HTML Using Notepad or TextEdit
Web pages can be created and modified by using professional HTML editors.
However, for learning HTML we recommend a simple text editor like Notepad (PC) or
TextEdit (Mac).
Follow the four steps below to create your first web page with Notepad or TextEdit.
Open the Start Screen (the window symbol at the bottom left on your screen). Type
Notepad.
Windows 7 or earlier:
</body>
</html>
Name the file "index.htm" and set the encoding to UTF-8 (which is the preferred encoding
for HTML files).
HTML offers tags and attributes to style a website’s text, images, and more. This improves
visual appeal, helps users navigate the content, and signals important information to users.
The <i> tag in HTML is used to display the content in italic style. This tag is generally used
to display the technical term, phrase, the important word in a different language. The <i>
tag is a container tag that contains the opening tag, content & closing tag.
Syntax
The <b> tag in HTML makes text bold without adding importance, unlike <strong>, which
signifies importance. It has opening and closing tags and purely changes text appearance.
Syntax
Syntax
The <small> tag in HTML is used to define smaller text, reducing font size. It decreases the
font size by one size (from medium to small, from x-large to large
Syntax:
HTML <ins> tag is used to specify a block of inserted text. The <ins> tag is typically used to
mark a range of text that has been added to the document. The inserted text is rendered as
underlined text by the web browsers. The <ins> tag requires a starting and ending tag.
Syntax:
This <sub> tag in HTML is used to write text below the baseline of the text in a smaller font.
This tag can be used in many ways like we can denote some mathematical variables in the
form of subscript text.
Syntax:
The <sup> tag in HTML describes the text as a superscript text. Here the text is above the
baseline of the text and that text appears in a smaller font.
Syntax:
The HTML <strong> Tag is the parsed tag and is used to show the importance of the text.
The content inside it is generally in bold format. The primary purpose of <strong> tag is to
provide semantic meaning to the content, indicating its importance to both browsers and
developers.
The <mark> tag in HTML is used to define the marked text. It is used to highlight the part
of the text in a paragraph. The <mark> tag is new in HTML 5.
Syntax:
HTML <del> Tag is used to mark a portion of text that has been deleted from the document.
The deleted text is rendered as strike-through text by the web browsers. The <del> tag
requires a starting and ending tag.
Syntax
HTML <em> tag is used to emphasize text, typically rendering it in italics. It conveys
importance or stress semantically and is widely employed for emphasis within paragraphs or
sentences.
Syntax:
HTML Headings
HTML headings are defined with the <h1> to <h6> tags.
<h1> defines the most important heading. <h6> defines the least important heading:
Example
HTML Paragraphs
HTML paragraphs are defined with the <p> tag:
Example
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
Large or small screens, and resized windows will create different results.
With HTML, you cannot change the output by adding extra spaces or extra lines in your
HTML code.
The browser will remove any extra spaces and extra lines when the page is displayed:
Example
<p>
This paragraph
contains a lot of lines
in the source code,
but the browser
ignores it.
</p>
<p>
This paragraph
contains a lot of spaces
in the source code,
but the browser
ignores it.
</p>
Example
Example
<img src="img_girl.jpg">
Example
The value of the attribute can be read by screen readers. This way, someone "listening" to the
webpage, e.g. a blind person, can "hear" the element.
Example
HTML Images
HTML images are defined with the <img> tag.
The source file (src), alternative text (alt), width, and height are provided as attributes:
Example
The <hr> element is used to separate content (or define a change) in an HTML page:
Example
Use <br> if you want a line break (a new line) without starting a new paragraph:
Example
The text inside a <pre> element is displayed in a fixed-width font (usually Courier), and it
preserves both spaces and line breaks:
Example
<pre>
My Bonnie lies over the ocean.
HTML Fonts
Example
Example
Text Formatting
HTML also defines special elements for defining text with a special meaning.
HTML uses elements like <b> and <i> for formatting output, like bold or italic text.
Example
The HTML <strong> element defines strong text, with added semantic "strong" importance.
Example
Example
Example
Example
Example
Example
Example
Example
Each table row is defined with the <tr> tag. A table header is defined with the <th> tag. By
default, table headings are bold and centered. A table data/cell is defined with the <td> tag.
Example
Example
Example
Example
An Unordered List:
Item
Item
Item
Item
An Ordered List:
1. First item
2. Second item
3. Third item
4. Fourth item
The list items will be marked with bullets (small black circles) by default:
Example
<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Value Description
disc Sets the list item marker to a bullet (default)
circle Sets the list item marker to a circle
square Sets the list item marker to a square
Example - Disc
<ul type=disc>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Example - Circle
<ul type=circle>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Example - Square
<ul type=square>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ul>
Example
<ol>
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
Type Description
type="1" The list items will be numbered with numbers (default)
type="A" The list items will be numbered with uppercase letters
type="a" The list items will be numbered with lowercase letters
type="I" The list items will be numbered with uppercase roman numbers
type="i" The list items will be numbered with lowercase roman numbers
Numbers:
<ol type="1">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
Uppercase Letters:
<ol type="A">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
Lowercase Letters:
<ol type="a">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
<ol type="I">
<li>Coffee</li>
<li>Tea</li>
<li>Milk</li>
</ol>
Example
<ul>
<li>Coffee</li>
<li>Tea
<ul>
<li>Black tea</li>
<li>Green tea</li>
</ul>
</li>
<li>Milk</li>
</ul>
Example
Live Demo
<!DOCTYPE html>
<html>
<head>
</head>
<body>
</html>
Attributes
The HTML <marquee> tag supports the following attributes −