Web Technology
(Website Development)
Neeraj Kr. Gupta
Asstt. Prof.
IIMT, Meerut
Elements/HTML Tags
HTML documents imply a structure of nested HTML elements. These are
indicated in the document by HTML tags, enclosed in angle brackets
thus: <p>
In the simple, general case, the extent of an element is indicated by
a pair of tags: a "start tag" <p> and "end tag" </p>. The text content of the
element, if any, is placed between these tags.
Tags may also enclose further tag markup between the start and
end, including a mixture of tags and text. This indicates further, nested,
elements, as children of the parent element.
The start tag may also include attributes within the tag. These
indicate other information, such as identifiers for sections within the
document, identifiers used to bind style information to the presentation of
the document, and for some tags such as the <img> used to embed
images, the reference to the image resource.
Some elements, such as the line break <br>, do not
permit any embedded content, either text or further tags. These require
only a single empty tag and do not use an end tag.
The general form of an HTML element is therefore:
1. Container Tag
<tag attribute1="value1“ attribute2="value2">
content
</tag>
2. Empty Tag
Some HTML elements are defined as empty elements and take
the form :
<tag attribute1="value1" attribute2="value2" >
Empty elements may enclose no content, for instance, the <BR>
tag or the inline <IMG >tag.
The name of an HTML element is the name used in the tags. Note
that the end tag's name is preceded by a slash character, "/", and
that in empty elements the end tag is neither required nor
allowed. If attributes are not mentioned, default values are used
in each case.
Various HTML Tags
• <html> Tag : This tag defines the top most element,
identifying it as an HTML document. It is a container
tag that has a start and an end tag and all the other
tags and texts are nested within it.
Syntax :
<html>
………
</html>
• <head> Tag : This tag contains information about your
HTML file. It may also contain other tags that helps you to
identify your HTML file to the outside world. The head tag
is nested within the html tag.
Syntax :
<html>
<head>
………
</head>
</html>
• <title> Tag : This tag is nested within the head tag. It
identifies your page to the rest of the world. It is used to
specify the title of your web page that will be displayed
on the browser’s title bar.
Syntax :
<html>
<head>
<title>
Specify the title
</title>
</head>
</html>
• <body> Tag : This tag is used after the <head> tag to
specify the body/contents of the web page. This tag
contains all of the tags that a browser actually displays as
the body of your html document.
Syntax :
<html><head>
<title> Specify the title </title></head>
<body>
……………
</body>
</html>
Attributes of <body> Tag
• <body> tag may comprises of following attributes :
Attribute Description
BGCOLOR Change the default background color to whatever
color is specified with this attribute.
BACKGROUND Specifies the name of the picture file that will be
used as the background of the document.
TEXT Changes the body text color from its default value
to the color specified with this attribute.
LINK Specifies the color of unvisited links in a document
ALINK Specifies the color of an active link in a document
VLINK Specifies the color of visited links in a document
Note : The color can be specified by name , its
equivalent hexadecimal no. or RGB no. as follows :
<body bgcolor=“color_name|hex_number|RGB_number”>
Attribute Values
Value Description
color_name Specifies the color with a name like ”red”
hex_number Specifies the color with a hex code like
“#ff0000”
Rgb_number Specifies the color with a rgb code like
“rgb(255,0,0)”