Page 74 - Computer - 7
P. 74
HTML tags are of two types –
(a) Container Tag: A Container Tag is made up of a pair of tags – a START tag and an END tag. Some
examples of container tags are <head> ... </head>, <body> ... </body> and <title> ... </title> tags.
The slash / in any tag indicates that it is the END tag for a container tag.
(b) Empty Tag: An Empty Tag requires a START tag but not an END tag. An empty tag does not have
any content following it and is used to perform a specific action, such as drawing a horizontal line.
Some examples of empty tags are <br> and <hr>.
HTML Attributes
An Attribute is a special keyword used to enhance the behaviour of an HTML element. It is always
specified inside the START tag of an element. Each attribute consists of the attribute’s name followed by
the equal to sign (=) and the attribute’s value enclosed within quotes. For example:
<html lang = “en-US”>
Here, the <html> tag has the attribute lang that specifies the language of the web page.
Knowledge Discovery Subject Enrichment
Tags placed within other tags are called Nested Tags. You must close the nested tags properly and according
to their order. For example:
<head> <title> Sample Text </title> </head>
is the correct way of nesting tags, while
<head> <title> Sample Text </head> </title>
is the incorrect way of nesting tags.
STRUCTURE OF AN HTML DOCUMENT
An HTML document contains two basic parts: the HEAD and the BODY. The head section contains
information about the document, such as the title. The body section contains the actual text, images,
and everything else that is displayed on the web page.
The basic structure of an HTML document is:
• <!DOCTYPE html> : The <!DOCTYPE html> is a declaration written at the beginning of the HTML
document. It is an instruction to the web browser about the type of document used.
• <html> tag : The <html> tag is a container tag that identifies the document as an HTML document.
An HTML document begins with <html> tag and ends with </html> tag. A web browser interprets
everything that comes in between the HTML tags.
• <head> tag : The <head> tag is a container tag that contains information about the document,
including its title, style definitions,
and document descriptions. The
<head> tag is nested between the
opening and closing <html> tags.
• <title> tag : The <title> tag is a HTML Head
container tag that specifies the Document Section
title of a web page. The <title> tag Body
is nested between the opening Section
and closing <head> tags.
72