Essential HTML Tags Explained
Essential HTML Tags Explained
CHAPTER TWO
HTML TAGS
01/08/2026
[Link] HTML Tags
2
pages.
A markup language is a set of markup tags, and HTML
The first tag in a pair is the start tag, the second tag
01/08/2026
[Link] HTML Tags…
6
01/08/2026
[Link] HTML Tags…
7
01/08/2026
[Link] HTML Tags…
10
<HEAD> </HEAD>
The web page should have only one head tag.
The head tag starts with <head> and ends with
</head>.
The text or tags that are inside the head tag will not
be displayed in the browser window.
One of the important tags which is put inside
<head> is <title> </title> tag.
Title tags are used to give title to the browser
window.
01/08/2026
[Link] HTML Tags…
11
<!DOCTYPE HTML>
<html>
<head>
<title>My First HTML Page</title>
</head>
<body>
<p>This is some text that will appear on the web page </p>
</body>
</html>
01/08/2026
[Link] HTML Tags…
12
<BODY> </BODY>
This is where we place our content for
our visitors.
What we place here will be displayed to
our visitors.
A <body> element may contain
anything from a couple of paragraphs
under a heading to more complicated
layouts containing forms and tables.
01/08/2026
[Link] HTML Tags…
14
<html> attribute
Setting HTML Language
The HTML lang attribute can be used to declare the
language of a Web page or a portion of a Web page.
This is meant to assist search engines and browsers.
01/08/2026
[Link] HTML Tags…
18
<html lang=“om">
<head>
<title>Setting Language</title>
</head>
<body>
This web page in Afan Oromo
</body>
</html>
01/08/2026
[Link] HTML Tags…
19
<body> Attributes
Background Color
You can change background color of your web
page by using <BODY> tag attribute bgcolor
<body bgcolor=”green”>
Background Image
We can use a background picture for web page instead of
background color.
You must have an image to do this.
Then you can use background attribute of <BODY> tag
as follows:
<BODY BACKGROUND="[Link]">
Text Color
We can also set the text color of the web page just like
background color.
We use text attribute of <BODY> to do this.
Example:
<HTML>
<HEAD>
<TITLE>Page with Back
Color</TITLE>
</HEAD>
<BODY bgcolor="yellow"
text="#FF0000">
Page with yellow back color and red
text color
</BODY>
</HTML> Fig Back and text colors of body
01/08/2026
[Link] HTML Tags…
22
links.
link: Sets a color for link text.
vlink: Sets a color for visited links - that is, for linked
engines.
It was a critical element for early search engines
01/08/2026
[Link] HTML Tags…
29
Creating Links
A hyperlink (or link) is a word, group of words, or
(the link text) and the URL (the destination site, page or resource).
The URL is specified using href attribute.
Here is an example:
loaded document.
_self then loads the new page in current window. By default its _self.
01/08/2026
[Link] HTML Tags…
32
If you place the cursor over the link, you will see the text in the
title attribute.
Example:
the link.
For example, you could make the T key an access key so that
when the user presses either the Alt or Ctrl key on his keyboard
along with the T key, the link gets activated.
Example:
01/08/2026
<a href="[Link]" target="_blank" accesskey="m">First
[Link] HTML Tags…
34
Linking to email
It is also possible to make a link to an e-mail address.
document.
To link to an email, you type mailto: followed by an e-
mail address.
Example:
<a href="[Link] an e-mail to us
</a>
When the link is clicked, the default e-mail program opens
with a new blank message addressed to the specified e-
mail address.
This function will only work if there is an01/08/2026
e-mail program
installed on your computer.
2. HTML Text Formatting Tags
35
HTML Headings
In HTML, you can create different heading levels in
your document to help you organize the document
into sections, just as you might do when writing a
book.
A heading element briefly describes the topic of
the section it introduces.
Headings are defined with the <h1> to <h6> tags.
<h1> defines the largest heading and <h6> the
smallest heading. 01/08/2026
2. HTML Text Formatting
36
Tags…
Heading tags are block tags, and you must specify opening
and closing tags.
Example:
<body>
<h1>this is heading level 1.</h1>
<h2>this is heading level 2.</h2>
<h3>this is heading level 3.</h3>
<h4>this is heading level 4.</h4>
<h5>this is heading level 5.</h5>
<h6>this is heading level 6.</h6>
</body>
01/08/2026
[Link] Text Formatting
37
Tags…
HTML Paragraphs
Authors traditionally divide their thoughts and
arguments into sequences of paragraphs.
Along with using headings to structure your Web page,
you can add structure by grouping common text into
paragraphs.
Paragraphs are defined with the <p> tag.
Example:
<p>This is a paragraph</p>
<p>This is another paragraph</p>
Both of the above tags will enforce a new line whenever
you write the tag. 01/08/2026
[Link] Text Formatting
38
Tags…
The <p> element is a block element.
It cannot contain block-level elements including <p> itself.
Align attribute can be used also with other tags like headers,
etc.
Example:
<p align="center">This is center aligned.</p>
<p align="justify">This is justified. This works when you
have multiple lines in your paragraph and 01/08/2026
you want to
[Link] Text Formatting
39
Tags…
HTML Fonts
The <font> tag is used to add font type, size, and color to the
size,
color, and
face
Example:
<font size="1">Font size=1</font>
<font size="2">Font size=2</font>
<font size="3">Font size=3</font>
<font size="4">Font size=4</font>
<font size="5">Font size=5</font>
<font size="6">Font size=6</font> 01/08/2026
[Link] Text Formatting
41
Tags…
Specify Relative Font Size
You can also specify relative font sizes instead of exact font size.
<font size="+n">
<font size="-n">
This specifies how many sizes larger or how many sizes smaller than the
But be aware that if the user viewing the page doesn't have
Example:
<font face="Times New Roman" size="5"> Times New Roman
</font>
<font face="Verdana" size="5"> Verdana </font>
<font face="Comic sans MS" size="5"> Comic Sans MS </font>
<font face="WildWest" size="5"> WildWest </font>
01/08/2026
[Link] Text Formatting
43
Tags…
A visitor will only be able to see your font if they
have that font installed on their computer.
So, it is possible to specify two or more font face
alternatives by listing the font face names,
separated by a comma.
Example:
<font face="arial, helvetica">
<font face="Lucida Calligraphy, Comic Sans MS,
Lucida Console>
01/08/2026
[Link] Text Formatting
44
Tags…
Font Color:
You can set any font color you like using color
attribute.
You can specify the color that you want by either
the color name or hexadecimal code for that color.
Check a complete list of HTML Color Name with
Codes.
Example:
<font color="#0000FF">This text blue color</font>
<font color="red">This text is red</font>
01/08/2026
[Link] Text Formatting
45
Tags…
The <basefont> Element:
The <basefont> element is used to set a default
font size, color, and typeface for any parts of the
document that are not otherwise contained within
a <font> element.
You can then use the <font> elements to override
the <basefont> settings.
01/08/2026
[Link] Text Formatting
47
Tags…
Formatting Tags
In HTML, there are many tags that you can use to
enhance and change the look of the text.
You can make text bold, italicized, or underlined;
these are just some of the presentational options
available to indicate how text can appear in HTML.
in italicized face.
Example:
<p>The following word uses a <i>italicized</i>
typeface.</p>
This will produce following result: 01/08/2026
[Link] Text Formatting
49
Tags…
Underlined Text - The <u> Element:
Anything that appears in a <u>...</u> element
Example:
<p>The following word uses a
<u>underlined</u> typeface.</p>
This will produce following result:
The following word uses a underlined typeface.
01/08/2026
[Link] Text Formatting
50
Tags…
Centering Content - The <center> Element:
You can use <center> tag to put any content in
Example:
<p>This is not in the center.</p>
<center> <p>This is in the center.</p>
</center>
01/08/2026
[Link] Text Formatting
51
Tags…
Strike Text - The <strike> Element:
Anything that appears in a <strike>...</strike>
Example
<p>The following word uses a
<strike>strikethrough</strike> typeface.</p>
You can also use <br /> which does the same.
Example:
<p> The chemical formula for water is H<sub>2</sub>O
</p>
01/08/2026
<p> Solve 5X<sup>2</sup>+6X+10 </p>
2. HTML Text Formatting
57
Tags…
Big and small Text:
The <big> tag displays texts in big.
The content of the <big> element is displayed
one font size larger than the rest of the text
surrounding it.
01/08/2026
2. HTML Text Formatting
60
Tags…
Tag Description
<em> Renders as emphasized text
<strong> Renders as strong (highlighted) text
<dfn> Defines a definition term
<code> Defines computer code text
<samp> Defines sample output from computer code
<kbd> Defines keyboard text
<var> Defines a variable part of a text
<cite> Defines a citation
<abbr> Defines an abbreviation
<acronym> Defines an acronym
<q> Defines a short quotation.
<blockquote> To quote a passage from another source
01/08/2026
2. HTML Text Formatting
61
Tags…
<html>
<head> <title>HTML Tags</title>
</head>
<body>
<abbr title="World Health
Organization">WHO</abbr> reports that malaria
epidemic is increasing. <br>
Two <acronym title="North Atlantic Treaty
Organization">NATO</acronym> troops are killed in
Afghanistan. <br><em>Emphasized text</em>
<br>
<strong>Strong text</strong> <br>
<dfn>Definition term</dfn> <br>
<code>Computer code text</code> <br>
<samp>Sample computer code text</samp> <br>
<kbd>Keyboard text</kbd> <br>
<var>Variable</var> <br>
<cite>Citation</cite> <br>
01/08/2026
</body>
2. HTML Text Formatting
62
Tags…
Special Characters
Characters within HTML documents that
are not part of a tag are rendered as-is by
the browser.
However, some characters have special
meaning and are not directly rendered,
while other characters can't be typed into
the source document from a conventional
keyboard.
Special characters need either a special
name or a numeric character encoding for
01/08/2026
Character Code Short name Character name
" " " quotation mark
' ' ' apostrophe
& & & ampersand
< < < less-than
> > > greater-than
  non-breaking space
¡ ¡ ¡ inverted exclamation mark
¢ ¢ ¢ cent
£ £ £ pound
¤ ¤ ¤ currency
¥ ¥ ¥ yen
¦ ¦ ¦ broken vertical bar
§ § § section
¨ ¨ ¨ spacing diaeresis
© © © copyright
ª ª ª feminine ordinal indicator
« « « angle quotation mark (left)
¼ ¼ ¼ fraction 1/4
½ ½ ½ fraction 1/2
¾ ¾ ¾ fraction 3/4
¿ ¿ ¿ inverted question mark
× × × multiplication
÷ ÷ ÷ division
¬ ¬ ¬ negation
­ ­ soft hyphen
® ® ® registered trademark
¯ ¯ ¯ spacing macron
° ° ° degree
± ± ± plus-or-minus
² ² ² superscript 2
³ ³ ³ superscript 3
´ ´ ´ spacing acute
µ µ µ micro
¶ ¶ ¶ paragraph
· · · middle dot
¸ ¸ ¸ spacing cedilla
¹ ¹ ¹ superscript 1
º º º masculine ordinal indicator
» » » angle quotation mark (right)
¼ ¼ ¼ fraction 1/4
½ ½ ½ fraction 1/2
¾ ¾ ¾ fraction 3/4
¿ ¿ ¿ inverted question mark
× × × multiplication
÷ ÷ ÷ division
[Link] Text Formatting
65
Tags…
Tags and Their Attributes
The <p>, <center>, <b>, <i>, <u>, <pre>,
01/08/2026
HTML Comments
66
Example:
<img src="[Link]" alt="Highland coffee"
width="100" height="100" border="2" align="right"
title="HTML Tutorial" />
01/08/2026
Inserting Image…
71
01/08/2026
Inserting Image…
72
Example:
<html>
<head>
<title>Testing HTML</title>
</head>
<body>
Just checking img tag.
<img src="[Link]" alt="Highland coffee"
align="left" hspace="50" vspace="100">
</body>
</html> 01/08/2026
Inserting Image…
74
01/08/2026
Image Map…
76
01/08/2026
Image Map…
77
The image is added to the web page in the usual way, but
with the addition of a usemap attribute, whose value must
be preceded by a hash sign (#).
Example:
<img src="[Link]" area shapes=“rect”
alt=“image map“ width="398" height="398"
usemap="#shape" />
To create the map used by img tag, we use the following tags
and attributes:
<map> tag maps information for an imagemap
name="text" - The legacy method for giving the map a
name
id="text" - The current method for giving the map a name
<area> tag contains information for a clickable area in an
imagemap.
The <area> element specifies the shape and the coordinates
that define the boundaries of each clickable hotspot.
shape="rect|circle|poly" - shape of the linked area
coords="numbers" - pixel coordinates for the linked area
01/08/2026
href="url" - target file for the link
Image Map…
79
01/08/2026
<html>
<head>
<title>Regional States</title>
</head>
<body>
<img src="Ethiopia_regions.png" width="350" height="269"
usemap="#map" />
<map name="map" id=”map”>
<area shape="poly" coords="85,30,86,16,96,17,97,18,
99,17,100,14,108,13,112,16,118,4, 122,7,125,8,
129,14,137,13,143,8,147,12,148,15,151,12,162,12,163,15,157,16,158,22,1
60,34,158,42,159,49,162,52,160,61,148,62,146,54,148,51,147,45,142,46,1
41,40,136,41,134,34,128,34,118,35,114,32,109,38,99,36,92,36,90,33,84,32,
84,30" href="[Link]" />
<area shape="poly"
coords="83,32,79,42,78,53,68,53,65,55,57,70,58,74,63,
74,69,68,74,69,76,76,81, 73,82,79,86,83,81,95,81,102,87,106,98,108,101,
112,108,114,113,118,129,111,131,105,139,106,135,114,139,121,144,122,1
50,120,150,126,153,129,148,131,151,135,149,142,156,141,160,139,160,13
4,162,130,162,120,167,115,168,111,168,96,168,85,165,78,159,62,149,63,1
46,55,148,47,143,46,141,41,136,40,133,34,123,35,117,34,115,32,110,38,1
04,38,96,36,85,32,84,32" href="[Link]" />
Table headers
Headers in a table are defined with the <th> tag.
The text in a <th> element will be bold and
centered. 01/08/2026
3. Tables…
84
Example:
<table border="1">
<tr>
<th>dept</th>
<th>cgpa</th>
</tr>
<tr>
<td>row 1, cell 1</td> <td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td> <td>row 2, cell 2</td>
01/08/2026
</tr>
3. Tables…
85
Header 1 Header 2
row 1, cell 1 row 1, cell 2
row 2, cell 1 row 2, cell 2
Attributes of table:
• The attributes of a table will be applied on the whole table
element which include one or more rows (<tr>), header
cells (<th>) or data cells (<td>).
01/08/2026
Attribute Value Description
align Left Specifies the alignment of a table according to
Center surrounding text
right
cellpadding pixels Specifies the space between the cell wall and the
cell content
cellspacing pixels Specifies the space between cells
width Pixels Specifies the width of a table
%
height Pixels Specifies the height of a table
%
3. Tables…
87
Example:
<table border="5" bordercolor="green" bgcolor="gray">
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
<tr><td rowspan="2">Row 1 Cell 1</td>
<td bgcolor="red">Row 1 Cell 2</td>
<td>Row 1 Cell 3</td>
</tr>
<tr><td>Row 2 Cell 2</td>
<td>Row 2 Cell 3</td>
</tr>
<tr><td colspan="3">Row 3 Cell 1</td></tr>
01/08/2026
</table>
3. Tables…
88
Example:
<table border="1" cellpadding="15" cellspacing="10">
<tr> <th>Name</th> <th>Salary</th> </tr>
<tr> <td>Ramesh Raman</td> <td>5000</td> </tr>
<tr> <td>Shabbir Hussein</td> <td>7000</td> </tr>
</table>
01/08/2026
3. Tables…
90
justify
bgcolor rgb(x,x,x) Specifies a background color for a cell
#xxxxxx
Colorname
colspan number Specifies the number of columns a cell should span
rowspan number Sets the number of rows a cell should span
height Pixels Sets the height of a cell
% (percent)
width Pixels Specifies the width of a cell
%(percent)
nowrap nowrap Specifies that the content inside a cell should not wrap
valign top|middle|bottom Vertical aligns the content in a01/08/2026
table row
3. Tables…
91
Spanning rows and cells
<table border="1" cellpadding="2">
<tr>
<td>A cell</td>
<td>Another cell</td>
<td>Yet another cell!</td>
</tr>
<tr>
<td rowspan="2">A cell that spans two rows</td>
<td colspan="2">A cell that spans two columns</td>
</tr>
<tr>
<td>Another cell</td>
<td>The last cell</td>
</tr> 01/08/2026
3. Tables…
92
01/08/2026
3. Tables…
93
Using a Header, Body, and Footer:
Tables can be divided into three portions: a header, a body, and a
foot.
The head and foot are rather similar to headers and footers in a word-
processed document that remain the same for every page, while the
body is the main content of the table.
The three elements for separating the head, body, and foot of a table
are:
<thead> - to create a separate table header.
<tbody> - to indicate the main body of the table.
<tfoot> - to create a separate table footer.
01/08/2026
Ordered and Unordered List
96
01/08/2026
Ordered and Unordered List…
97
Unordered List
An unordered list starts with the <ul> tag.
The list items are marked with bullets (typically small black
circles).
The “type” attribute can be used to specifies the style of the bullet
points of the list items, its value includes disc, square and circle.
Example:
<ul>
<li>Banana</li>
<li>Orange</li>
</ul>
<ul> attributes:
01/08/2026
Ordered and Unordered List…
99
Ordered List
An ordered list starts with the <ol> tag.
Example:
Example
<ol start="17">
<li>Highlight the text with the text tool.</li>
<li>Select the Character tab.</li>
<li>Choose a typeface from the pop-up menu.</li>
</ol>
The resulting list items would be numbered 17, 18, and 19,
consecutively.
01/08/2026
Ordered and Unordered List…
10
1
Example:
<ol>
<li>Super computer</li>
<li>Mainframe computer</li>
<li>Mini computer</li>
<li>Micro computer</li>
<ul>
<li>Desktop computer</li>
<li>Laptop Computer</li>
<li>Palmtop computer</li>
</ul>
01/08/2026
</ol>
HTML Forms
10
4
HTML forms are used to pass data to a server.
Users generally "fill" a form by modifying its controls (entering
text, selecting list items, etc.) before submitting the form for
further processing by server.
Forms are a vital tool for the webmaster to receive information
from the web surfer, such as their name, email address, credit
card, etc.
You may store that data into a file, place an order, gather user
statistics, register the person to your web forum, or maybe
subscribe them to your weekly newsletter.
A form will take input from the site visitor and then will post to
your back-end application such as CGI, ASP, PHP script etc.
Then your back-end application will do required processing on
that data in whatever way you like.- 01/08/2026
HTML Forms…
10
5
The <form> tag is used to create an HTML form:
<form>
input elements
</form>
The most important element inside form element is the
input element.
The input element is used to accept user information.
An input element can vary in many ways, depending on
the type attribute.
An input element can be of type text field, checkbox,
password, radio button, submit button, and more.
The most used input types are described in the next
subsections.
01/08/2026
The form itself is not visible but form elements are
HTML Forms…
10
6
Text Field
You can create text field by using:
<input type="text">
This defines a one-line input field that a user can enter text
into.
Example:
01/08/2026
<input type="text" name="username" size="8"
HTML Forms…
10
8
Password
A password field works just like a text entry field, except the
characters are obscured (hidden) from view using asterisk
(*) or bullet (•) characters, or another character determined
by the browser.
We can define a password field like:
<input type="password" />
Example:
<form>
Password: <input type="password" name="pwd">
</form>
How the HTML code above looks in a browser:
Password: 01/08/2026
HTML Forms…
10
9
Text Area
At times, you may want your users to be able
Example:
<textarea name="comment"> Tell us what you
feel about our tutorial with 50 words or less.
</textarea>
01/08/2026
HTML Forms…
11
0
Text Area attributes:
Text area has the following attributes:
display.
Scrollbars will be provided if the user types more text than fits
of characters.
Example:
<textarea name="comment" rows="5" cols="100"> Tell us
what you feel about our tutorial with 50 words or less.
</textarea>
01/08/2026
HTML Forms…
11
1
Radio Buttons
Radio buttons are a popular form of interaction.
Example
<form>
<input type="radio" name="sex" value="male">
Male<br>
<input type="radio" name="sex" value="female">
Female
</form>
01/08/2026
HTML Forms…
11
3
Radio button attributes are:
name: sets name of the radio button
value: sets the value of the radio button. This is
the data sent to server when the user submits
the form.
checked: sets whether the radio button is
checked by default or not. It accepts the value
checked.
Example:
<form method=”post” action=”[Link]”>
<input type="radio" name="sex" value="male"
01/08/2026
checked=”checked”> Male <br>
HTML Forms…
11
4
Checkboxes
Check boxes allow for multiple items to be selected for a
as a radio button.
We can define a checkbox like:
<input type="checkbox">
Checkboxes let a user select ONE or MORE options.
Example:
<form>
<input type="checkbox" name="vehicle" value="Bike"> I
have a bike <br>
<input type="checkbox" name="vehicle" value="Car"> I
have a car
</form> 01/08/2026
HTML Forms…
11
5
Selection lists
Drop down menus are created with the <select> and <option>
tags.
<select> is the list itself and each <option> is an available
Example:
Educational level: <br>
<select name="degree">
<option>Choose One</option>
<option>Some High School</option>
<option>High School Degree</option>
<option>Some College</option>
<option>Bachelor's Degree</option>
<option>Doctorate</option> 01/08/2026
</select>
HTML Forms…
11
6
Checkbox attributes are:
name: sets name of the checkbox
value: sets the value of the checkbox. This is the data sent to server
when the user submits the form.
checked: sets whether the checkbox is checked by default or not. It
accepts the value checked.
Example:
What type of food do you like?
<ul>
<li><input type="checkbox" name="genre" value=" spaghetti "
checked="checked"> Spaghetti</li>
<li><input type="checkbox" name="genre" value="pizza"
checked="checked"> Pizza</li>
<li><input type="checkbox" name="genre"
value="sandwich">Sandwich </li>
<li><input type="checkbox" name="genre"
01/08/2026
value="Burger">Burger</li>
HTML Forms…
11
7
Attributes of select
Attribute Value Description
disabled disabled Specifies that a drop-down list should be disabled
multiple multiple Specifies that multiple options can be selected
name text Specifies the name of a drop-down list
size number Specifies the number of visible options in a drop-down list
Attribute of option
Attribute value Description
selected selected Specifies whether the option is selected or not
when the form loads
01/08/2026
HTML Forms…
11
8
Scrolling Lists
To make the menu display as a scrolling list, simply specify
01/08/2026
HTML Forms…
12
0
Button
There are a number of different kinds of buttons that
submit button,
reset button, and
client side button.
Submit Button
When clicked, the submit button immediately sends the
Reset Button
The reset button returns the form controls to the state
JavaScript.
It has no predefined function on its own, as submit
a label.
name: used to give name to the button
Example:
01/08/2026
HTML Forms…
12
4
Image button can be defined as follows:
<input type="image">
Example:
<input type="image" src="[Link]"
01/08/2026
value="Submit">
HTML Forms…
12
5
The button element
The button element is a flexible element for creating
button.
The button includes a label and a small image.
form processing application that does not come from the user.
In these instances, you can use a hidden form control that
sends data when the form is submitted, but is not visible when
the form is displayed in a browser.
<input type="hidden">
Hidden controls are added using the input element with the
01/08/2026
HTML Forms…
13
2
<!DOCTYPE html>
A submit button is used to
<html>
send form data to a server.
<body>
The data is sent to the <h2>HTML Forms</h2>
page specified in the <form
form's action attribute . action="[Link]
The file defined in the _page.php">
action attribute usually <label for="fname">First
does something with the name:</label><br>
received input: <input type="text" id="fname"
name="fname" value="John"><br>
<label for="lname">Last
<form name="input"
name:</label><br>
action="[Link]"
<input type="text" id="lname"
method="get">
name="lname" value="Doe"><br><br>
Username: <input <input type="submit" value="Submit">
type="text" </form>
name="user"> <p>If you click the "Submit"
01/08/2026 button, the
<input type="submit" form-data will be sent to a page called
HTML Forms…
13
3
Automating Processing: Info Forms and Emails
If you would like to provide your web site visitors with a simple way to
contact you from your web site, but really don't want to display your email
address, this HTML form code may be what you're looking for.
You can create a simple form, to enable your visitors to send you
comments, questions, product support requests, or whatever you'd like.
<form action=[Link] method=“post" enctype="text/plain">
Your Name: <input type="text" size="20“ name="VisitorName">
<br><br>
Your Comment: <textarea name="VisitorComment" rows="4" cols="20">
</textarea><br><br>
<input type="submit" value="Email This Form">
</form>
01/08/2026
Fieldsets
13
4
Fieldsets are used to enclose a group of related form fields:
01/08/2026
Frames
13
8
Frames can divide the screen into separate windows.
Each of these windows can contain an HTML document.
A file that specifies how the screen is divided into
frames is called a frameset.
The frameset page lacks a <body> element (although
it still requires head and title elements) and instead
uses a <frameset> element, which sets the attributes
for how the frames are positioned.
The frameset element houses frame elements, which
define the location and attribute of each frame.
01/08/2026
Frames…
13
9
When a frameset page is loaded, the browser automatically
loads each of the pages associated with the frames.
Each HTML document is called a frame, and each frame is
independent of the others.
The disadvantages of using frames are:
The web developer must keep track of more HTML documents
It is difficult to print the entire page
The frameset element holds two or more frame elements.
Each frame element holds a separate document.
The frameset element sets no of columns or rows in the
frameset and it uses <frameset> tag.
The <frame> tag defines one particular window(frame)
within a frameset. 01/08/2026
Frames…
14
0
<frameset cols="25%,75%">
<frame src="frame_a.htm" />
<frame src="frame_b.htm" />
</frameset>
The frameset column size can also be set in pixels
(cols="200,500"), and one of the columns can be set
to use the remaining space, with an asterisk
(cols="25%,*").
You cannot use the body element together with the
frameset element.
However, if you add a <noframes> tag containing
some text for browsers that do not support frames,
you will have to enclose the text in a01/08/2026
body element.
Frames…
14
1
Attributes of frameset
Attribute Value Description
cols pixels Specifies the number and size of columns in a
% frameset
*
rows pixels Specifies the number and size of rows in a
% frameset
*
01/08/2026
Frames…
14
2
Example:
<frameset cols="30%,*">
<frame src="[Link]">
<frame src="[Link]">
</frameset>
01/08/2026
Frames…
14
3
Attributes of frame
Attribute Value Description
frameborder 0 or 1 Specifies whether or not to display a border around a frame
marginheight pixels Specifies the top and bottom margins of a frame
marginwidth pixels Specifies the left and right margins of a frame
noresize noresize Specifies that a frame cannot be resized
scrolling yes Specifies whether or not to display scrollbars in a frame
no
auto
src URL Specifies the URL of the document to show in a frame
01/08/2026
Frames…
14
4
You can also nest framesets, to create a
combination of columns and rows:
<frameset rows="120,*">
<frame noresize=”noresize” src="frame-
[Link]">
<frameset cols="150,*">
<frame src="[Link]">
<frame src="[Link]">
</frameset>
</frameset>
01/08/2026
Frames…
14
5
01/08/2026
Frames…
14
6
Nested Frames
Framesets may be nested to any level. In the following
example, the outer FRAMESET divides the available space into
three equal columns.
The inner FRAMESET then divides the second area into two
rows of unequal height.
Example:
<FRAMESET cols="33%, 33%, 34%">
<frame src=”[Link]”>
<FRAMESET rows="40%, 50%">
<frame src=”[Link]”>
<frame src=”[Link]”>
</FRAMESET>
<frame src=”[Link]”> 01/08/2026
Frames…
14
7
Working with iframes (internal frames)
The <iframe> tag defines an inline frame that
01/08/2026
14
8
<p>Your browser does not
<html> support iframes.</p>
<head> </iframe>
<title>Internal <br> <br>
Frame</title> <table border="1">
</head> <tr> <th>Name</th>
<body> <th>Salary</th> </tr>
<p> Maths is the base of <tr> <td>Chan Li</td>
many sciences including <td>5000</td> </tr>
<tr> <td>Anna Andrey</td>
engineering, computer
<td>7000</td> </tr>
science, physics, etc. </p> </table>
<br> <br> </body>
<iframe src ="[Link]" </html>
width="100%"
height="300"> 01/08/2026
Inserting Multimedia
14
9
You can add music or video into your web page.
The easiest way to add video or sound to your
web site is to use <embed> tag.
The src attribute of <embed> tag defines what
video/audio file to embed into the page.
This tag causes the browser itself to include
controls for the multimedia automatically.
Example:
<embed src="[Link]" autostart="false" />
01/08/2026
Inserting Multimedia…
15
0
The following is the list of important attributes for <embed> element.
align - determines how to align the object. It takes either center, left or right.
autostart - Indicates if the media should start playing automatically. Netscape
default is true, Internet Explorer is false.
loop - Specifies if the sound should be played continuously (set loop to true), a
certain number of times (a positive value) or not at all (false). This is supported
by Netscape only.
playcount - Specifies the number of times to play the sound. This is alternate
option for loop if you are usiong IE.
hidden - Defines if the object shows on the page. A false value means no and
true means yes.
height – set height of the object.
width – set width of the object.
pluginspage - Specifies the URL to get the plugin software.
name - A name used to reference the object.
src - URL of the object to be embedded. This can be any recognizable by the
user's browser. It could be .mid, .wav, .mp3, .avi and so on).
volume - Controls volume of the sound. Can be from 0 (off) to 100 (full volume).
01/08/2026
This attribute is supported by Netscape only.
Inserting Multimedia…
15
1
Example:
<embed src="[Link]
Pluginspage="[Link] width="320"
height="250"
CONTROLLER="true" LOOP="false" AUTOPLAY="false" name="IBM
Video">
</embed>
File types that are supported by the embed tag are Flash movies
(.swf), mpeg(.mpg or .mpeg), AVI's (.avi), and MOV's (.mov).
.swf files - are the file types created by Adobe Flash program.
.wmv files - are Microsoft's Window's Media Video file types.
.mov files - are Apple's Quick Time Movie format.
.mpeg files - are movie files created by the Moving Pictures Expert
Group.
Macromedia's .swf and .mpeg formats may be the best options for web
because the high compression reduces file size and expedites the
01/08/2026
download periods for your page visitors.
HTML Graphics
15
2
HTML Canvas
The HTML <canvas> element is used to draw graphics on a web page.
The graphic to the left is created with <canvas>. It shows four elements: a red
rectangle, a gradient rectangle, a multicolor rectangle, and a multicolor text.
The <canvas> element is only a container for graphics. You must use JavaScript to
actually draw the graphics.
Canvas has several methods for drawing paths, boxes, circles, text, and adding
images.
01/08/2026
15
3
Add a JavaScript: After creating the
<!DOCTYPE html> rectangular canvas area, you must add a
<html> JavaScript to do the drawing.
<!DOCTYPE html>
<body>
<html>
<canvas id="myCanvas"
<body>
width="200" height="100"
<canvas id="myCanvas" width="200"
style="border:1px solid
height="100" style="border:1px solid
#000000;">
#d3d3d3;">
</canvas>
tag.</canvas>
</body>
<script>
</html>
var c =
[Link]("myCanvas");
var ctx = [Link]("2d");
[Link](0,0);
[Link](200,100);
[Link]();
</script>
</body>
01/08/2026
</html>
15
4
<!DOCTYPE html>
<html>
<body>
<canvas id="myCanvas" width="200" height="100"
style="border:1px solid #d3d3d3;">
. </canvas>
<script>
var c = [Link]("myCanvas");
var ctx = [Link]("2d");
[Link] = "30px Arial";
[Link]("Hello World",10,50);
</script>
</body>
</html>
01/08/2026
ClockClock using
15
5
<!DOCTYPE html> var ctx =
[Link]("2d");
<html> var radius = [Link] /
<body> 2;
<canvas id="canvas"
[Link](radius,
width="400" height="400" radius);
style="background- radius = radius * 0.90
color:#333"> setInterval(drawClock,
1000);
</canvas>
<script> function drawClock() {
drawFace(ctx, radius);
var canvas = drawNumbers(ctx, radius);
[Link]( drawTime(ctx, radius);
"canvas"); }
01/08/2026
Clock using Canvas
15
6 function drawFace(ctx, radius) {
var grad; function drawNumbers(ctx, radius)
[Link](); var ang;
[Link](0, 0, radius, 0, 2*[Link]); var num;
[Link] = 'white'; [Link] = radius*0.15 + "px arial"
[Link](); [Link]="middle";
grad = [Link]="center";
[Link](0,0,radius*0 for(num = 1; num < 13; num++){
.95, 0,0,radius*1.05); ang = num * [Link] / 6;
[Link](0, '#333'); [Link](ang);
[Link](0.5, 'white'); [Link](0, -radius*0.85);
[Link](1, '#333'); [Link](-ang);
[Link] = grad; [Link]([Link](), 0, 0);
[Link] = radius*0.1; [Link](ang);
[Link](); [Link](0, radius*0.85);
[Link](); [Link](-ang);
[Link](0, 0, radius*0.1, 0, }
2*[Link]); }
01/08/2026
[Link] = '#333';
15
7 function drawTime(ctx, radius){
function drawHand(ctx,
var now = new Date();
pos, length, width) {
var hour = [Link]();
[Link](); var minute = [Link]();
[Link] = width; var second = [Link]();
[Link] = "round"; //hour
[Link](0,0); hour=hour%12;
[Link](pos); hour=(hour*[Link]/6)+
(minute*[Link]/(6*60))+
[Link](0, -length);
(second*[Link]/(360*60));
[Link]();
drawHand(ctx, hour, radius*0.5,
[Link](-pos); radius*0.07);
} //minute minute=(minute*[Link]/30)+
</script> (second*[Link]/(30*60));
drawHand(ctx, minute, radius*0.8,
</body> radius*0.07);
// second
</html>
second=(second*[Link]/30);
drawHand(ctx, second, radius*0.9,
radius*0.02);
} 01/08/2026
15
8
HTML SVG •SVG stands for Scalable Vector Graphics
•SVG is used to define graphics for the
Web
The HTML <svg> Element
The HTML <svg> element is a container for SVG graphics. SVG has several
methods for drawing paths, boxes, circles, text, and graphic images.
<!DOCTYPE html>
<html>
<body>
<svg width="100" height="100">
<circle cx="50" cy="50" r="40"
stroke="green" stroke-width="4"
fill="yellow" />
</svg>
</body>
</html>
01/08/2026
15
9
<!DOCTYPE html>
<html>
<body>
<svg height="150" width="500">
<ellipse cx="240" cy="100" rx="220"
ry="30" style="fill:purple" />
<ellipse cx="220" cy="70" rx="190"
ry="20" style="fill:lime" />
<ellipse cx="210" cy="45" rx="170"
ry="15" style="fill:yellow" />
Sorry, your browser does not support
inline SVG.
</svg>
</body>
</html>
01/08/2026
SVG Advantages
16
0
Advantages of using SVG over other image formats (like JPEG
and GIF) are:
SVG images can be created and edited with any text editor
SVG images can be searched, indexed, scripted, and
compressed
SVG images are scalable
SVG images can be printed with high quality at any resolution
SVG images are zoomable
SVG graphics do NOT lose any quality if they are zoomed or
resized
SVG is an open standard
SVG files are pure XML
01/08/2026