HTML Notes Final
HTML Notes Final
HTML stands for Hypertext Markup Language. It is a markup language that describes the
structure of the web page. It allows us to create web pages that contain paragraphs, headings,
links and block quotes. The first version of HTML was written by Tim Berners-Lee in 1993.
Key features of HTML:
• It is a platform-independent language.
• It is not case-sensitive language.
• It is a very easy and simple language.
• It allows us to add a link on the web page.
• It provides a flexible way to design web pages along with text.
HTML Tags and Attributes: As we know that HTML is a markup language. It uses tags
to markup the content of the web pages. These tags also have their attributes. Let us
learn more about tags and attributes.
TAGS: Tags are the basic building blocks of a web page. They tell the browser how the
information is to be displayed on the web page. Tags do not appear in the browser window
but they affect the display of the text and non-text items in it. Each tag in HTML follows
specific rules and syntax, HTML tags are not case sensitive.
In HTML document, a tag name begins with an opening angular bracket (<) and ends with
closing angular bracket (>). For example, <Tag name> content </Tag name>
Both opening and closing tags are same. The only difference is that the closing tag contains a
forward slash in front of the tag name. Most of the tags in HTML have opening and closing
tags. A combination of opening tag, content, and closing tag is called an element. The HTML
tags can be categorised as:
• Container Tags: The tags that have both opening and closing tags are called Container
Tags. For example, <B>……</B>, <Head>……</Head>
• Empty Tags: Empty tags contains only opening tags. They do not have closing tags.
These tags do not enclose any data. For example, <BR>, <HR> etc.
HTML tags can also be further classified as:
• Block Level Tags: The block level tags take up the full width available and by default
begin on a new line. Some of the block level tags are Paragraph <P>, headings <H1>
to <H6>, Horizontal Rule <HR>, etc.
• Text Level Tags: The text level tags are used to mark-up parts of text. These tags do
not start with new line. Some of the text level tags are Bold <B>, Superscript <SUP>,
Italic <I>, Subscript <SUB>, etc.
Nesting of Tags: Nesting of tags means that you can start a new tag before closing the
previous tag. The only point to remember is that tags are nested on LIFO principle, that is,
Last in First Out. This means that the tag that has been opened last needs to be closed first.
The <HTML> Tag: The <HTML tag tells the web browser that the text contained between
<HTML and </HTML> is a web page and can be viewed using a web browser. Every web
page coding must starts with the <HTML> tag and ends with the </HTML> tag.
The <HEAD> Tag: The <HEAD> tag defines header area of your web page. The
information given in <HEAD> tag Tells the computer that this information is not to be shown
on the web page. The <HEAD> is a container tag used in pair as <HEAD> and </HEAD>.
Every web page coding must have its header tag.
The <TITLE> Tag: The <TITLE> tag tells the web browser that the text contained between
<TITLE> and </TITLE> does not form part of the web page. It will be shown on the Title
Bar of your web browser. The use of <TITLE> tag is not mandatory. If you do not want to
give title to your web page, you can skip it. Your web browser will show file name and its
path as title of your web page.
The <BODY> Tag: The <BODY> tag tells the web browser that the text contained between
<BODY> and </BODY> tags is to be shown on the web page. It is a container tag. The
<BODY> tag has the following attributes:
• BGCOLOR: This attribute defines a colour to the background of your web page. It can
be used as <BODY BGCOLOR="red">
• TEXT: This attribute defines a colour to the text of your web page. It can be used as
<BODY TEXT="blue">
• BACKGROUND: This inserts the image as the background of the web page:
<BODY BACKGROUND="image.jpg">
Different attributes can be used simultaneously like this:
<BODY BGCOLOR="red" TEXT="white">
The <Hn> Tag: Every chapter in a book has various headings and sub-headings. These are
known as levels of headings. The heading tags are used to give similar effect to your web
page. These are container tags with a start tag and an end tag. HTML can define up to 6
levels of headings from hi to h6. The h1 is the first level of heading and the h6 is the last
level of heading/ sub-heading. For example,
<html>
<body>
<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>
</body>
</html>
Heading tags have ALIGN attribute. The ALIGN attribute allows you to align your heading
to left side, centre or right side of your web page. It can be used as:
<h1 align="left"> aligns towards left of webpage </h1>
<h2 align="center"> aligns towards center of webpage </h2>
<h3 align="right"> aligns towards sight of webpage </h3>
The <p> Tag: The Paragraph tag is written as <P> This tag defines start and end of a
paragraph in the text. It is both a container as well as an empty tag. Whenever you want to
start a new paragraph, you can start the paragraph tag using <P> without closing the previous
paragraph tag. In order to avoid confusion, it is advised to use this tag as a container tag
starting with the <P> tag and ending with the </P> tag. The paragraph tag automatically
inserts a blank line between two paragraphs.
<html>
<body>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
</body>
</html>
The <P> tag use the ALIGN attribute. The ALIGN attribute can take three values:
• Left: It aligns the text to the left of the web page. For example,
<p align="left"> Animation </p>
• Right: It aligns the text to the right of the web page. For example,
<p align="right"> Animation </p>
• Center: It aligns the text to the center of the web page. For example,
<p align=" center "> Animation </p>
The <BR> Tag: The Line Break tag is written as <BR>. This tag is used when you want to
start a new line, but do not want to start a new paragraph. This means that you want your text
to come in next line without leaving a blank line in between. This tag forces a line break
wherever you will place it. It is an empty tag. It is used as under:
<html>
<body>
<p>This is<br>a paragraph<br>with line breaks.</p>
</body>
</html>
The <HR> Tag: The Horizontal ruler tag is written as <HR>. This tag is used when you
want to divide your web page into different sections. It is also used when you want to draw a
line between two paragraphs. It is an empty tag. It gives a horizontal ruler (line) on the page
and then the next element will be shown in a new line after the ruler.
<html>
<body>
<h1>This is heading 1</h1>
<p>This is some text.</p>
<hr>
<h2>This is heading 2</h2>
<p>This is some other text.</p>
<hr>
<h2>This is heading 2</h2>
<p>This is some other text.</p>
</body>
</html>
The <B> Tag: The Bold tag is written as <B>, This tag is used to give bold effect to your
text. You need to tell the web browser when to start using the bold effect and where to stop
using the bold effect. It is a container tag and used in pair as <B> and </B>.
The <I> Tag: The Italic tag is written as <I>. This tag is used to give italic effect to your
text. You need to tell the web browser when to start using the italic effect and where to stop
using the italic effect. It is also a container tag and used in pair as <I> and </I>.
The <U> Tag: The Underline tag is written as <U>. This tag is used to underline your text.
You need to tell the web browser when to start underlining and where to stop underlining the
text. It is a container tag and used in pair as <U> and </U>.
The <SUP> Tag: The superscript tag is written as <SUP>. This tag is used to turn the
enclosed text into a superscript. For example, E=mc² is coded as E=mc<sup>2</sup>
The <SUB> Tag: The subscript tag is written as <SUB>. This tag is used to turn the
enclosed text into a subscript. For example, H₂O is coded as H<sub>2</sub>0
The <FONT> Tag: HTML provides the <FONT> tag to change the certain properties such
as font size, face and colour of a block of text on a web page. To do this, the <FONT> tag
provides three attributes which you can use in the following way:
• FACE: It allows you to set the font family such as Times New Roman, Verdana. <font
face="Times New Roman"> Animation </p>
• SIZE: It allows you to set the font size.
<font size="4"> Animation </p>
• COLOR: It allows you to set the font color.
<font color="green"> Animation </p>
The <CENTER> Tag:
Earlier we have used the ALIGN attribute to align the text to center. HTML also provide the
<CENTER> tag which allows us to align the text in center. The <CENTER> does not have
any attribute.We can use the <CENTER> tag in the following way:
<center> text to be align in center </center>
Type the following HTML code in the notepad window and save the file with the name Environment.html
<html>
<head>
<title> Note on Environment </title>
</head>
<body bgcolor="yellow">
<font face="Ebrima" size="6" color="red">
<u> <b><p align="center">Web page on Environment </p></b></u>
</font>
<h2> Environment</h2>
<font face="ms sans serif" color="black">
<b>Environment</b> is everything that is <i>around us</i>. It can be living
(<u>biotic</u>) or non-living (<u>abiotic</u>) things. It includes physical,chemical and
other natural forces. <br>Living things live in their environment.They constantly interact
with it and adapt themselves to conditions in their environment. </font>
<hr>
<h5 align="right"> This web page has been created by </h5>
<p align="right"> <b> Enter Your Name here </b> </p>
</body>
</html>
Editing an existing HTML document: To edit a web page, you need to follow a special
procedure. Follow these steps to edit a HTML document:
1. Locate your file.
2. Right click on the file icon to open right click menu.
3. Hover mouse pointer over open with option to open a sub-menu.
4. Click on Notepad. This will open your HTML document in Notepad so that you can
make changes in the file. After making required changes, you need to save the file by
pressing the Ctrl+S keys.
If your web-page is already open in web browser, you need to press the F5 key to see the
changes you have done.
Inserting Images
Images and other graphical elements such as drawings, paintings and charts are considered as
image in the web page. HTML allows us to insert images inside the web pages through the
<IMG> tag. The <IMG> tag is an empty tag and has various attributes. The attributes of the
<IMG> tag are:
➢ SRC: It specifies the source or URL of the image that has to be inserted in the web
page. For example, <IMG SRC= “C:/Mydocuments/panda.jpg”>
➢ WIDTH: It specifies the width of the image in the web page. For example, <IMG
SRC= “C:/Mydocuments/panda.jpg” WIDTH= “50%”>
➢ HEIGHT: It specifies the height of the image in the web page. For example, <IMG
SRC= “C:/Mydocuments/panda.jpg” HEIGHT= “50%”>
➢ ALIGN: It aligns the image with respect to the text placed adjacent to the image.
Image can be aligned left, right, middle, bottom and top. For example, <IMG SRC=
“C:/Mydocuments/panda.jpg” ALIGN= “Right”>
➢ BORDER: It specifies the thickness of the border surrounding the image. For example,
<IMG SRC= “C:/Mydocuments/panda.jpg” BORDER = “4”>
Use the <img> tag to insert an image on the web page in the following way:
<html>
<head><title> Inserting Image</title>
</head>
<body>
<b>Inserting image on the web page</b>
<img src= “C:/Mydocuments/panda.jpg” width = “50%” height= “50%” align= “right”
border= “3”>
</body>
</html>
Note:Some of the image formats supported by HTML are Joint Photographic Experts Group
(JPEG), Graphics Interchange Format(GIF) and Portable Network Graphics (PNG).
Creating Marquee
HTML allows you to move your objects left, right, up and down by using the <MARQUEE>
tag. The <MARQUEE> tag is a container tag. It takes the text or image between the opening
<MARQUEE> and the closing </MARQUEE> tags. For example,
<MARQUEE> Hello! I am a moving text </MARQUEE>
Similarly, the image can also be added to this moving part or section.
< MARQUEE >< img src= “C:/Mydocuments/panda.jpg”></ MARQUEE >
The <MARQUEE> tag has the following attributes:
• Behaviour: It can have three values, which are SLIDE, SCROLL and ALTERNATE
➢ < MARQUEE BEHAVIOR= “SLIDE”>
➢ < MARQUEE BEHAVIOR= “SCROLL”>
➢ < MARQUEE BEHAVIOR= “ALTERNATE”>
• Direction: It allows you to set the direction in which the object will move.
➢ < MARQUEE DIRECTION= “UP”>
➢ < MARQUEE DIRECTION= “DOWN”>
➢ < MARQUEE DIRECTION= “RIGHT”>
➢ < MARQUEE DIRECTION= “LEFT”>
• Scroll Amount: It indicates the speed of the moving object.
➢ < MARQUEE SCROLLAMOUNT= “1”>
➢ < MARQUEE SCROLLAMOUNT= “10”>
➢ < MARQUEE SCROLLAMOUNT= “20”>
Note: The SCROLLAMOUNT = 1 means the slowest moving object.
2. Create a web page by using the given specifications and use the appropriate HTML
Tags.(use the image given below for reference)
• The title of the web page should be EARTH DAY.
• The background colour of the page should be ‘Cyan’.
• Bold and underline the text EARTH DAY.
• The font face, font size, and font colour of the text EARTH DAY should be MS Sans
Serif, 7, and red, respectively.
• The colour, font face, and size of the other text should be 'Black, Ebrima, and 4,
respectively.
A Sample Web page
<html>
<head>
<title>My School</title>
</head>
<body bgcolor="Mahroon" text="white">
<fontface="stencil"size="7"color="orange">
<center>MY SCHOOL</center></font>
<hr size= "10" color="white">
<img src="C:\Users\user\Desktop\download (1).png" align="right" width="15%"
height="18%">
<h1 align = "center"><b><u>Introduction</u>
</b></h1>
<center>
<font face="harrington"size="4">
The name of my School is<br><b><i> Montfort School</b></i><br>
It is situated in Roorkee city<br>
</center></font>
<hr size= "10" color="white">
<h1 align="center"><b>Vision and Mission</b></h1>
<hr size= "2" color="blue">
<h2>Vision:</h2>
<p align="center"> The Montfortian mission is to help the young develop into upright,
creative and loyal citizens imbued with love and concern for others, spiritual sensitivity
and a sense of personal freedom, liberty of thought, expression, belief, faith and
Worship, equality of status and of opportunity and fraternity assuring the dignity of the
individual and the unity and integrity of nations.</p>
<p align="center">It envisions enabling the young to develop into a holistic personality
and earn a living; and contributing to the economic, social, political and cultural
progress of the nation.</p>
<hr size= "10" color="white">
<h2>Mission:</h2>
<p align="center"> Apart from the vision of Christian schools, Montfortian education,
in particular, aims to prepare the student for a life that is worth living. As individuals
and members of the society the students need to be helped to develop qualities of the
mind and heart as well as basic skills and attitudes. To achieve this the Montfortian
education system is designed as person-oriented, social or the other oriented,
professional or work oriented, national or citizen oriented and universal brotherhood
and international understanding oriented.</p>
<p align="center">*****************</p>
</body>
</html>
OUTPUT: