Working With Lists, Images and Hyperlinks
Working With Lists, Images and Hyperlinks
LEARNING OBJECTIVES
To understand the need for having lists
To study the various kinds of lists
To design pages containing images with different alignments
To appreciate the concept of image maps for easier navigability
To know about different types of Image formats
To be able to create links to other documents and within the same document
To be able to send mail through web sites
CONTENT OUTLINE
8.1 Introduction
8.2 Lists
8.3 The Image Tag
8.4 Image Formats
8.5 Image Maps
8.6 The <A> Tag – Anchor Tag
8.7 Turning an image into a hyperlink
8.8 Mailto attribute
83
Web Technology – Lists, Images & Hyperlinks Chapter 8
8.1 Introduction
As of now we have been able to create a basic web page. Now let us add some more
features which enable the web page to look more useful. Very often data has to be
organized in the form of lists. At other times it becomes necessary to consult other parts
of the same document or sometimes even other documents. Sometimes it is required to
display images so that descriptions become easier and more vivid. For achieving the
above tasks in this lesson we will learn about lists, images and hyperlinks. Hyper linked
text or images are those on which when clicked take you to other parts of the document.
8.2 Lists
There are three kinds of lists that can be made using HTML depending on the need. They
are
a) Unordered lists
b) Ordered lists
c) Data Definition Lists
An unordered list is a list of items. The list items are marked with bullets (typically small
black circles).
<ul>
<li>coffee</li>
<li>tea</li>
</ul>
• coffee
• tea
Inside a list item you can put paragraphs, line breaks, images, links, other lists, etc.
The unordered list has an attribute called type. It can take values like disc, square and
circle. The default is the disc
84
Web Technology – Lists, Images & Hyperlinks Chapter 8
Nested Lists
Lists can be nested. You can also have a number of paragraphs, each containing a nested
list, in a single list item. Here is a sample nested list:
<UL>
<LI> A few states of North India
<UL>
<LI> Punjab
<LI> Haryana
<LI> Kashmir
</UL>
<LI> A few states of South India
<UL>
<LI> Tamil Nadu
<LI> Karnataka
<LI> Kerala
</UL>
</UL>
An ordered list is also a list of items. The list items are marked with numbers. To make
an Ordered bulleted list,
2. For every list item enter the <LI> (list item) tag followed by the individual item; no
closing </LI> tag is needed.
85
Web Technology – Lists, Images & Hyperlinks Chapter 8
<ol>
<li>coffee
<li>tea
</ol>
Here is how it looks in a browser:
1 coffee
2 tea
Inside a list item you can put paragraphs, line breaks, images, links, other lists, etc.
2. start = number
This attribute specifies the starting number of the first item in an ordered list. The default
starting number is "1". Note that while the value of this attribute is an integer, the
corresponding label may be non-numeric. Thus, when the list item style is uppercase latin
letters (A, B, C, ...), start=3 means "C". When the style is lowercase roman numerals,
start=3 means "iii", etc.
3. value = number
This attribute sets the number of the current list item. Note that while the value of this
attribute is an integer, the corresponding label may be non-numeric
Example Write the code for the following output
86
Web Technology – Lists, Images & Hyperlinks Chapter 8
Figure: 8.1
<html>
<head>
<title>TYPES OF PLANTS</title>
</head>
<body >
There are many kinds of plants
<UL>
<LI> Herbs
<OL>
<LI> Corriander
<LI> Tulsi
</OL>
Apart from these common herbs there are some more like
<OL start="3">
<LI> Mint
<LI> Grass
</OL>
<LI>Shrubs
<OL>
<LI> Rose
<LI> Hibiscus
</OL>
</UL>
</body>
</html>
87
Web Technology – Lists, Images & Hyperlinks Chapter 8
A definition list is not a list of items. This is a list of terms and explanation of the terms A
definition list starts with the <dl> tag. Each definition-list term starts with the <dt> tag.
Each definition-list definition starts with the <dd> tag.
<dl>
<dt><strong>coffee</strong></dt>
<dd>Hot drink preferred in South India</dd>
<dt><strong>tea</strong></dt>
<dd>Hot drink preferred in North India</dd>
</dl>
A good way to think of it is that <DT> stands for "Definition-list Term" and <DD>
stands for "Definition-list Definition." When the above list is displayed, it arranges the
elements such that each term is associated with the corresponding definition. The exact
arrangement of elements may vary from browser to browser. Here's how the above
markup comes out:
Coffee
Hot drink preferred in South India
Tea
Hot drink preferred in North India
Inside a definition-list definition (the <dd> tag) you can put paragraphs, line breaks,
images, links, other lists, etc. Similar to ordered and unordered lists, definition lists can
be arbitrarily long. Definition lists are perfect for creating glossaries
The COMPACT attribute can be used routinely in case your definition terms are very
short. If, for example, you are showing some computer options, the options may fit on the
same line as the start of the definition.
<DL COMPACT>
<DT> Coffee
<DD>Hot drink preferred in South India
<DT>Tea
<DD>Hot drink preferred in North India
</DL>
88
Web Technology – Lists, Images & Hyperlinks Chapter 8
In HTML, images are defined with the <img> tag. The <img> tag is empty, which means
that it contains attributes only and it has no closing tag. To display an image on a page,
you need to use the src attribute. Src stands for "source". The value of the src attribute is
the URL of the image you want to display on your page.
<img src="url">
The URL points to the location where the image is stored. An image named "dance.gif"
located in the whose URL: D:\Documents and Settings\Administrator\Desktop\dance.gif
The browser puts the image where the image tag occurs in the document. If you put an
image tag between two paragraphs, the browser shows the first paragraph, then the
image, and then the second paragraph.
Figure: 8.2
89
Web Technology – Lists, Images & Hyperlinks Chapter 8
<html>
<head>
<title>Education Website of ABC </title>
</head>
<body>
<p>This is a ballroom dance class </p>
<img src="D:\Documents and Settings\Administrator\Desktop\dance.gif">
<p> Enrollment is going on
</body>
</html>
90
Web Technology – Lists, Images & Hyperlinks Chapter 8
</HTML>
<html>
<head>
</head>
<body>
<p> An image before the text
<img src="D:\Documents and
Settings\Administrator\Desktop\dance.gif"
width="48" height="48">
An image before the text
</p>
</body>
</html>
<html>
<head>
</head>
<body>
<p> An image after the text
An image after the text
<img src ="D:\Documents and
Settings\Administrator\Desktop\dance.gif"
width="48" height="48">
</p>
</body>
</html>
91
Web Technology – Lists, Images & Hyperlinks Chapter 8
3) ALT Æ Its value is a string which is displayed when you point at that area.
4) HREF ÆTakes the name of the .html file that is linked to the particular area in the
image
Example
Each button in the image below will cause a different page to be displayed. Clicking on
an area outside of a button will cause the default page to be displayed.
92
Web Technology – Lists, Images & Hyperlinks Chapter 8
The code to display the image and make it clickable is shown below.
<A HREF="http://www.webcom.com/webcom/imap/hpbar.map">
<IMG SRC="http://www.webcom.com/webcom/graphics/hp.gif" ISMAP></A>
This tag is used to link one document or one part of the document to another. Searching
information on the web is easy because we can define links from one page to another,
and can follow links at the click of a button. Links are defined with the <a> tag.
Whenever we click on a hypertext we get linked to other documents or to some other part
of a document. To include an anchor in your document:
93
Web Technology – Lists, Images & Hyperlinks Chapter 8
Example Use Notepad and in the desktop enter two files main.html and intro_html.html
whose contents are given below in the following table.
main.html intro_html.html
<html> <html>
<head> <head>
</head> </head>
<body> <body>
<H1>Welcome to the Website OF ABC <H1>Welcome to the Website OF ABC
Tutorials</H1> Tutorials</H1>
<H2> The following are the tutorials <H2> The following few pages will teach you
provided by ABC Tutorials</H2> something about HTML</H2>
<p><A Href="Intro_html.html" >Tutorial <p><b>What is HTML<b>
on HTML </A> <p>Hyper Text Markup Language is a
<p><A Href ="scripting.html" > Tutorial “markup language”. It is a set of instructions
on Scripting Languages </A> to your web browser to display the text in a
<p><A Href ="asp.html" > Tutorial on certain way. It allows the easy presentation
Active Server Pages </A> and navigation of information over multiple
</body> computers. HTML is a subset of SGML,
</html> Standard Generalized Markup Language,
which is a generic way of representing any
document.
SGML is more or less too complicated to be
useful, but it has spawned two important
subsets, HTML and XML. HTML was
invented for the Internet by Tim Berners-Lee
at CERN( European Laboratory for Particle
Physics) in Geneva.
</body>
94
Web Technology – Lists, Images & Hyperlinks Chapter 8
</html>
Now open the Internet Explorer and enter in the address bar D:\Documents and
Settings\Administrator\Desktop\main.html
8.6.2 To link one part of the document to another part of the same document.
Anchors can also be used to move a reader to a particular section in the same document.
This type of an anchor is commonly called a named anchor because to create the links,
you insert HTML names within the same document.
Example
In the following example if you click on the hypertext Tutorial Section Headings then
automatically the control goes to the place in the tutorial where section headings are
explained. The reason being that named anchor called section has been used.
95
Web Technology – Lists, Images & Hyperlinks Chapter 8
<html>
<head>
</head>
<body>
<H1>Welcome to the Website OF ABC Tutorials</H1>
<p><A Href="#section" >Tutorial Section Headings </A>
<p><A Href ="#title" > Tutorial on Scripting Languages </A>
<p> Introduction
Hyper Text Markup Language is a “markup language”. It is a set of instructions to
your web browser to display the text in a certain way. It allows the easy
presentation and navigation of information over multiple computers. HTML is a
subset of SGML, Standard Generalized Markup Language, which is a generic way
of representing any document. SGML is more or less too complicated to be
useful, but it has spawned two important subsets, HTML and XML. HTML was
invented for the Internet by Tim Berners-Lee at CERN( European Laboratory for
Particle Physics) in Geneva.<p>The basic feature in HTML documents is the “tag”. Tags
are set off by angle brackets (“<“ and “>”), with the tag name between them. Most tags
occur in pairs,
indicating what is supposed to happen to whatever text is between them. The
closing tag has the same name as the opening tag, but the closing tag starts with a
slash (/).
<p><b>Note on HTML Editors</b>
You can easily edit HTML files using a WYSIWYG (what you see is what you
get) editor like FrontPage, Claris Home Page, or Adobe PageMill instead of
writing your markup tags in a plain text file but in order to be a skillful Web
developer, it is suggested that a plain text editor is more helpful.
<H2> The following are the tutorials provided by ABC Tutorials</H2>
<h2> <A NAME="section"> Section Headings</A></H2>
<p>Headings are defined with the h1 to h6 tags. h1 defines the largest heading. h6
defines the smallest heading. HTML automatically adds an extra blank line before
and after a heading.
<p>
<h2> <A NAME="title"> Title Element</A></H2>
This container is placed within the HEAD structure. Between the TITLE tags, is
the title of your document. This will appear at the top of the browser's title bar,
and also appears in the history list. Finally, the contents of the TITLE container go
into your bookmark file, if you create a bookmark to a page. What you type
should probably be something which indicates the document's contents. If you
don't type anything between the TITLE tags, or don't include the TITLE tags at all
then the browser will typically use the actual file name for the title. You should
only have one TITLE container per document.
</body>
</html>
8.6.3. To link one document on one server to another document on a different server
96
Web Technology – Lists, Images & Hyperlinks Chapter 8
The World Wide Web uses Uniform Resource Locators (URLs) to specify the location of
files on other servers. A URL includes the type of resource being accessed (e.g., Web,
gopher, WAIS), the address of the server, and the location of the file. The syntax is:
scheme://host.domain [:port]/path/ filename
where scheme is one of the following
Scheme Explanation
File a file on your local system
ftp a file on an anonymous FTP server
http a file on a World Wide Web server
Gopher a file on a Gopher server
WAIS a file on a WAIS server
News a Usenet newsgroup
telnet a connection to a Telnet-based service
The port number can generally be omitted. (unless specifically mentioned.)
To link to a page on another Web site you need to give the full Web address (commonly
called a URL), for instance to link to www.w3.org you need to write:
This is a link to <a href="http://www.w3.org/">W3C</a>.
You can turn an image into a hypertext link, for example, the following allows you to
click on the company logo to get to the home page:
<a href="/"><img src="logo.gif" alt="home page"></a>
You can click on an image and get linked to another file also.
<a href=”abc.html”><img src=”dance.gif” alt=”picture of a dancing couple”</a>
<A HREF="mailto:emailinfo@host">Name</a>
Example <A HREF =”mailto:[email protected]”>Contact Me </A>
Exercises
1. What is the difference between JPEG and GIF image files ?
2. What are image maps and how are they different from simple images
3. If images are not visible on a browser then what should the web programmer do
to inform the surfer what the image is all about ?
4. When do we use absolute referencing and relative referencing
5. For making the following lists which kinds of lists would you use ? Justify .
a) Dictionary
b) Price list
c) Attendance Register
97
Web Technology – Lists, Images & Hyperlinks Chapter 8
d) Ingredients of a recipe
e) Stock Requisition List
f) Library Accession Register
Practical Exercises
1. Using lists design the following format
Uninstalling NetMeeting
If you uninstall Windows NT Service Pack 3 after installing NetMeeting, you will receive
an error message each time you restart your computer. To prevent this, do the following:
In Windows 98, the NetMeeting desktop shortcut and Quick Launch toolbar icons are not
removed when NetMeeting is uninstalled.
98
Web Technology – Lists, Images & Hyperlinks Chapter 8
3. Make the following clickable images. Example when the user clicks communication
the user should get the name of the network and it’s details and its communication pattern
99