Basic of HTML Notes Chapter 1
Basic of HTML Notes Chapter 1
HTML stands for Hypertext Markup Language and it is a widely used programming
language used to develop web pages.
<BODY> tag
The <BODY> tag is used to control the content of the web page. The following are
the important attributes of the <body> tag:
Attribute Description
Bgcolor To specify the background color of the
web page
1
Class 9 – HTML Notes BASICS OF HTML
The output of the above HTML code in the browser window is:
2
Class 9 – HTML Notes BASICS OF HTML
Topmargin
leftmargin
Text
color
(red)
Backgroun
d color
(pink)
3
Class 9 – HTML Notes BASICS OF HTML
Type the following HTML code in the notepad window:
Level 1
heading
aligned
left
Level 2
heading
aligned
left
Level 3
heading
aligned
center
Level 4
heading
Normal body text
aligned
center
4
Class 9 – HTML Notes BASICS OF HTML
The <BR> tag shifts the text following it to the next line. It is an empty tag. It does not
have any attributes.
Let us consider the same web page created before. You can display the names of
monuments in different lines by including the <BR> tag as shown in the following
notepad window:
The output of the above HTML code in the browser window is:
5
Class 9 – HTML Notes BASICS OF HTML
Line Break
Line Break
6
Class 9 – HTML Notes BASICS OF HTML
The output of the above HTML code in the browser window is:
Paragraph
aligned
left
Paragraph
Paragrap
aligned
h aligned
right
center
7
Class 9 – HTML Notes BASICS OF HTML
8
Class 9 – HTML Notes BASICS OF HTML
thickness of the horizontal line.
The value is given in pixels.
Width To specify the length of the <HR width=500>
horizontal line. The value can be OR
given in pixels or in percentage
of <HR width=70%>
page width.
Align To specify the placement of the <HR align=center>
horizontal line on the web page.
The values that can be used are:
left
right
center
To specify that the horizontal
Noshade line <HR noshade>
should appear as a solid stripe
across the page, rather than a
shaded stripe.
Color To specify the color of the <HR color=blue>
horizontal line.
Type the following code in the notepad window:
9
Class 9 – HTML Notes BASICS OF HTML
Horizontal
line with
thickness
5
Default
horizonta
l line
Horizontal
line with Horizontal
thickness line with
5 thickness
and 5 and
noshading color blue
<FONT> tag
The <font>tag is used to change the appearance of the text to be displayed on the web
page. Using this tag, you can change the size, color, and style of the text. It is a
container tag. The important attributes of <FONT> tag are:
10
Class 9 – HTML Notes BASICS OF HTML
CENTER Tag
The <center> tag is a container tag. You can enclose the text or the image to be
aligned in the center of the browser window within the opening and closing center
tag.
11
Class 9 – HTML Notes BASICS OF HTML
Let us consider the above example to align the text ‘India Gate’ in the center of
the browser window by modifying the HTML code:
The output of the above HTML code in the browser window is:
Text
aligned in
the center
12
Class 9 – HTML Notes BASICS OF HTML
13
Class 9 – HTML Notes BASICS OF HTML
Text in
bold
Text
in
Text italics
underlined
Listing tags
We can create the following types of lists using HTML
1. Unordered lists
2. Ordered lists
Unordered Lists
Unordered lists appear as a list of items with bullets in front of each list item. An
Unordered list is contained within the <UL> and </UL> tags. Each item in the list
is marked using the<LI>(List Item) tag. The important attributes of <UL> tag is:
Attribute Description
Type To specify the type of bullet to be placed in
front of each item in the list. The values
that are given to this attribute are:
Disc
Square
Circle
o
e.g. <UL type=”square”>
<LI> Vegetables
<LI> Fruits
<LI> Salads
</UL>
Output:
Vegetables
Fruits
Salads
14
Class 9 – HTML Notes BASICS OF HTML
Ordered Lists
Ordered lists are numbered list of items. By default, the browser numbers each
successive list item starting with “1”. An Ordered list is contained within the <OL>
and </OL> tags. Each item in the list is marked using the<LI> (List Item) tag. The
important attributes of <OL> tag is:
Attribute Description
Type To specify the type of numbering to be
used in front of each item in the list.
The values that are given to this
attribute are: A, a, I, i, and 1(default).
Start To specify a number to start the
numbering from a different letter or a
number.
e.g.
<OL type=”A”>
<LI> Vegetables
<LI> Fruits
<LI> Salads
</UL>
Output:
A. Vegetables
B. Fruits
C. Salads
If you use the start attribute of the <OL> tag as shown below, the numbering would
start from a different letter or number:
e.g.
<OL type=”A” start=”3”>
<LI> Vegetables
<LI> Fruits
<LI> Salads
</UL>
Output:
C. Vegetables
D. Fruits
E. Salads
The table given below outlines the output, which is displayed when you use the following
values for the type and start attributes of the <OL> tag:
Type and Start Output
Values
<OL type=A start=1> A. Vegetables
B. Fruits
15
Class 9 – HTML Notes BASICS OF HTML
C. Salads
<OL type=a start=1> a. Vegetables
b. Fruits
c. Salads
<OL type=I start=2> II. Vegetables
III. Fruits
IV. Salads
<OL type=i start=3> iii. Vegetables
iv. Fruits
v. Salads
<OL type=1> 1. Vegetables
OR 2. Fruits
<OL> 3. Salads
(default)
Nested Lists
Ordered and unordered lists can be nested within each other to form multilevel lists.
The following HTML code displays the output as shown in figure :
<HTML>
<BODY bgcolor=pink>
<H1 align=center> Online Books Library</H1>
Books are our best friends. We can obtain many thoughts
from books.
<BR>
The various categories of books featured in our library are:
<OL type=A>
<LI> Autobiography
<OL type=a>
<LI> My Experiments with Truth
<LI> Wings of Fire
</OL>
<LI> Fiction
<UL type=circle>
<LI> Bacon Death
<LI> Pride and Prejudice
</UL>
<LI> Adventure
<UL type=square>
<LI> Gulliver's Travels
<LI> The Phantom Tollbooth
</UL>
</OL>
</BODY>
<HTML>
16
Class 9 – HTML Notes BASICS OF HTML
17
Class 9 – HTML Notes BASICS OF HTML
In HTML, you insert images using the <IMG> tag. It is an empty tag. The following table
lists the attributes of the <IMG> tag:
The following HTML code uses different attributes of the <IMG> tag to display the
output as shown in figure
<HTML>
<HEAD>
<TITLE> Flowers </TITLE>
<BODY bgcolor=pink>
<HR size=4 color=blue width=50%>
<H1 align=center> Beauty of Flowers</H1> <HR size=4
color=blue width=50%>
<IMG src="tulips.jpg" height=100 width=100 border=6> <FONT
color=purple> A thing of beauty is a joy forever. Flowers are a symbol of nature's
divine beauty. </FONT>
<IMG src="sunflower.jpg" height=100 width=100 border=6 alt=”Flowers
image”>
</BODY>
</HTML>
18
Class 9 – HTML Notes BASICS OF HTML
The align attribute of the <IMG> tag lets you specify the placement of image on the web
page. To align the image with respect to margins, you use left or right as the attribute
value as done in the following code:
<HTML>
<HEAD>
<TITLE> Flowers </TITLE>
<BODY bgcolor=pink>
<HR size=4 color=blue width=50%>
<H1 align=center> Beauty of Flowers</H1> <HR size=4
color=blue width=50%>
<IMG src="tulips.jpg" height=100 width=100 border=6 align=left>
<FONT color=purple> A thing of beauty is a joy forever.
Flowers are a symbol of nature's divine beauty.
<IMG src="sunflower.jpg" height=100 width=100 align=right border=6>
<BR><BR><BR><BR>
19
Class 9 – HTML Notes BASICS OF HTML
<P align=right> Looking at flowers makes us feel happy and pleasant.
Flowers are the greatest gift of God. </FONT></p>
</BODY>
</HTML>
The other three values that can be given to the align attribute are top, middle, and
bottom. These values align the image with respect to text on the web page. The
following code uses these attribute values to display the output as shown in fig :
<HTML>
<HEAD>
<TITLE> Flowers </TITLE>
<BODY bgcolor=pink>
<HR size=4 color=blue width=50%>
<H1 align=center> Beauty of Flowers</H1> <HR size=4
color=blue width=50%>
<IMG src="tulips.jpg" height=100 width=100 border=6 align=top>
20
Class 9 – HTML Notes BASICS OF HTML
<FONT color=purple> A thing of beauty is a joy forever. Flowers are a symbol of
nature's divine beauty. <BR><BR>
21
Class 9 – HTML Notes BASICS OF HTML
Note:To align the image in center with respect to margins, enclose the <IMG>
tag inside the <CENTER> tag as shown below:
<CENTER> <IMG src=”tulips.jpg”></CENTER>
HYPERLINKS IN HTML
While surfing the Internet, you come across several text strings or images which when
clicked opens a different web page for you. These text strings or images are called
hyperlinks. Hyperlinks are the essence of World Wide Web. Hyperlinks interconnect
web pages over the World Wide Web. Linking involves linking various sections of the
same web page, i.e. upon clicking a hyperlink, a different section of the same web
page becomes visible in the browser window. This type of linking is useful when the
content on a web page extend across multiple pages. It serves as a bookmark to go to a
particular segment of the web page. For eg. Go to Top of the Page link on web pages
Attribute Description
Href This attribute indicates the path of the file or the name of the
section to which you want to link to.
Name This attribute is used for linking sections on the same web page. It
indicates the name of the section within a web page.
Target You can use the target attribute of <A> tag to specify the name of
the window where the linked page should be displayed. For
example, setting the target attribute to _blank opens the link
information in a new window.
<a href=”flowers.html” target=”_blank”> Click here</a>
22