Webtech 511
Webtech 511
FACULTYOF INFORMATIONTECHNOLOGY
WEBTECHNOLOGY511
YEAR 1 SEMESTER1
Page | 0
WEB TECHNOLOGY 511
Registered with the Department of Higher Education as a Private Higher Education Institution under
the Higher Education Act, 1997.
Registration Certificate No. 2000/HE07/008
LEARNER GUIDE
PREPARED ON BEHALF OF
RICHFIELD Graduate Institute of Technology (PTY) LTD
Copyright © 2018
Richfield Graduate Institute of Technology (Pty) Ltd
Registration Number: 2000/000757/07
All rights reserved; no part of this publication may be reproduced in any form or by any means, including
photocopying machines, without the written permission of the Institution.
Page | 1
WEB TECHNOLOGY 511
Page | 2
WEB TECHNOLOGY 511
Page | 3
WEB TECHNOLOGY 511
PRESCRIBED TEXTBOOK:
INTERNET & WOZLD WIDE WEB How to Program, 5th Edition, by Paul Deiltel, Harvey Deitel, Abbey
Deitel.
Page | 4
WEB TECHNOLOGY 511
LEARNING OUTCOMES
financial transaction, real time updates, online booking, job search, blogging and
WIDEWEB
shopping. The roots of the internet are in government applications, but no single
organization controls the Internet
1.2 THE WORLD WIDE WEB
WORLDWIDE
The term WWW refers to the World Wide Web or simply the Web. The World Wide
Web consists of all the public Web sites connected to the Internet worldwide,
including the client devices (such as computers and cell phones) that access Web
ANDWORLD
content. The WWW is just one of many applications of the Internet and computer
networks.The World Web is based on these
technologies:
HTML - Hypertext Markup Language
HTTP Hypertext Transfer Protocol
INTERNETAND
collection of computers the late 1980s and early 1990s. He helped build
connected to each other for the prototypes of the above Web technologies and
purpose of sharing resources. coined the term "WWW." Web sites and Web
ONE|
Page | 5
WEB TECHNOLOGY 511
Page | 6
WEB TECHNOLOGY 511
providers, such America Online, not only give you access to the Internet, but also provide
proprietary Web browsing software and content.
1.4 COMMUNICATION PROTOCOLS
In an effort to standardize data transmission, the Transmission Control
Protocol/Internet Protocol was created. Today,
we refer to this protocol as TCP/IP. More
specifically, Hypertext Markup Language (HTML)
is the standard programming language used to
build documents for the Web; and Hypertext
Transfer Protocol (HTTP) is the set of rules used
Multimedia Resource
to distribute hypertext documents on the Web.
https://www.commonsensemedia.o For most Web sites, you will need to use HTTP.
rg/videos/what-is-the-internet There are two other protocols that you might run
across:
HTTPS: This is HTTP with a Secure Sockets Layer (SSL) security added on. HTPS
is a communication protocol for secure communication over a computer network.
This protocol is used for online transactions and other activities that require accounts
and privacy (e.g. Online shopping, Facebook, etc.) to protect information that is
being transferred (username, password, credit card information, etc.).
File Transfer Protocol (FTP): This is a protocol which is used to transfer files
between computers running TCP/IP. Some FTP sites allow you to access them
anonymously without supplying a user name and password.
Page | 7
WEB TECHNOLOGY 511
Top-level domains
The top-level domain name provides a hint as to the type of organization in which
the Internet host computer resides. Outside the United States, the top-level domain
contains a two-letter country code as well. For example, CA represents Canada, DE
represents Germany, and KR represents South Korea. You can search for “Internet
country codes” on the Web to view a complete listing. The following table lists the
top-level domains.
Domain Description
.com Commercial businesses
.edu Educational institutions
.gov Governmental institutions
.mil Military institutions
.net Networks
.org Organizations (usually non-profit)
ONE| INTERNET AND WORLD WIDE WEB
For example, Jane Doe in the marketing department of Acme Corporation might
have the following address:
Page | 8
WEB TECHNOLOGY 511
When reading Internet addresses, the “@” symbol is pronounced as “at” and the periods are pronounced
as “dot.” The example address is read as “Jane Doe at marketing dot Acme dot com.” Internet addresses
have become standard business card data.
Page | 9
WEB TECHNOLOGY 511
Exhibit 0-1: The SMTP protocol is used to send e-mail to a recipient’s mail server and
POP3 or IMAP4 protocol is used to download e-mail to the client
Read
PRESCRIBED TEXTBOOK:
INTERNET & WOZLD WIDE WEB How to Program, 5th Edition, by Paul Deiltel,
Harvey Deitel, Abbey Deitel. Page 33, 44 and 50
http://www.gcflearnfree.org/internet101/1
Page | 10
WEB TECHNOLOGY 511
Connectivity Device: One of several types of specialized devices that allows two or
more networks or multiple parts of one network to connect and exchange data.
E-mail : messages distributed by electronic means from one computer user to one
or more recipients via a network.
Hypertext Markup Language: a standardized system for tagging text files to achieve
font, colour, graphic, and hyperlink effects on World Wide Web pages
Internet: A complex WAN that connects LANs and clients around the globe.
Internet Address: is a numerical label assigned to each device (e.g., computer,
printer) participating in a computer network that uses the Internet Protocol for
communication.
Internet Service Provider:an organization that provides services for accessing, using,
or participating in the Internet.
Network: A group of computers and other devices (such as printers) that are
connected by and can exchange data via some type of transmission media, such as
a cable, a wire, or the atmosphere.
Post Office Protocol version 3(POP3): a standard mail protocol used to receive emails
from a remote server to a local email client.
Simple Mail Transfer Protocol(SMTP) : It's a set of communication guidelines that
allow software to transmit email over the Internet.
Uniform Resource Locator (URL): the generic term for all types of names and
addresses that refer to objects on the World Wide Web.
Web browser:a software application for retrieving, presenting and traversing
information resources on the World Wide Web.
Web Server: a program that, using the client/server model and the World
Wide Web's Hypertext Transfer Protocol (HTTP), serves the files that
ONE| GLOSSARY OF TERMS
form Web pages to Web users (whose computers contain HTTP clients that forward
their requests).
Page | 11
WEB TECHNOLOGY 511
3. Internet requires
a. an international agreement to connect computers
b. a local area network
c. a commonly agreed set of rules to communicate between computers
d. a World Wide Web
5. P address is currently
a. 4 bytes long
b. available in plenty
c. 6 bytes long
d. not assigned as it is all used up
Page | 12
WEB TECHNOLOGY 511
9. Internet uses
a. Packet switching
ONE| REVIEW MULTIPLE CHOICE QUESTIONS
b. Circuit switching
c. Telephone switching
d. Telex switching
Page | 13
WEB TECHNOLOGY 511
Page | 14
WEB TECHNOLOGY 511
1.2 To connect to the internet, what are the three main things you must have?
A. PC, Modem, Airtime
B. PC, connection device, Access to host computer
C. PC, Modem, Speakers
D. Access to a PC, Access to a connection device, access to a mouse
Page | 15
WEB TECHNOLOGY 511
1.8 There are many protocols used today. Which protocol is used to
transfer files between computers running TCP/IP?
A. HTTPS
B. FTP
C. SSL
D. TCP/IP
ONE| REVIEW MULTIPLE CHOICE QUESTIONS
Page | 16
WEB TECHNOLOGY 511
TWO|INTRODUCTION TO HTML
LEARNING OUTCOMES
1. Define HTML
2. Differentiate between XML and HTML
3. Appreciate different coding approaches
Page | 17
WEB TECHNOLOGY 511
HTML is not a What You See Is What You Get (WYSIWYG) layout tool. It was
intended only to express logical document structure, not formatting
characteristics.Although many current HTML editors let you work with a
TWO| INTRODUCTION TO HTML
Despite its limitations, HTML is ideal for the Web because it is an open, non-
proprietary, cross-platform compatible language. All of the markup tags are
included with every document and usually can be viewed through your
browser. Once you are familiar with the HTML syntax, you will find that one
of the best ways to learn new coding techniques is to find a Web page you
like and view the source code.
Page | 18
WEB TECHNOLOGY 511
Features of XML
Some of the features of XML that makes it a very useful language are:
XML describes data: The power of data representation in XML comes
from separating display and style from the structure of data. XML elements
describe data and structure only and not presentation. Where HTML contains
Page | 19
WEB TECHNOLOGY 511
elements that describe a word as bold or italic, XML declares an element to be a book title,
item price, or product measurement. Once the data are structured in XML, they can be
displayed across a variety of media,such as a computer display, television screen, or
handheld device, using an associated style sheet that contains the appropriate display
information. Currently, Cascading Style Sheets is the only complete style language for
XML, though the W3C is working on the Extensible Style Language (XSL), which is derived
from XML.
XML allows better access to data: XML is valuable because it allows access to
more meaningful searches for information, development of flexible applications,
multiple views of data, and is based on a non-proprietary standard that supports the
open nature of the Web. People as well as machines can read XML code. Some years
from now, someone could open your XML file and understand what you meant by using
<HEADLINE> and <PARAGRAPH> as markup elements. The cross-platform, independent
nature of XML markup supports a variety of data applications migrating to the Web. XML
lets you display data on many devices without changing the essential data descriptions.
XML lends itself to customized information: XML is ideal for distributing
complex, esoteric information among many users sharing the same types of
knowledge. With the customized elements of XML, standards organizations for
various industries and information types can enforce the use of markup constraints
with all users. For example,chemists can have their own chemical markup language,
and poets can have their own poetic markup language—ensuring that the content
can be read and understood by anyone interested in their information type. Currently,
XML still is under development. Many of the proposed features of XML, including XML
linking and the Extensible Style Language,still are incomplete and supported differently by
Read
TWO| INTRODUCTION TO HTML
PRESCRIBED TEXTBOOK:
INTERNET & WOZLD WIDE WEB How to Program, 5th Edition, by Paul Deiltel,
Harvey Deitel, Abbey Deitel. Page 70 - 73
http://www.gcflearnfree.org/internet101/1
different vendors. Internet Explorer 5.0 is currently the only browser that supports XML,
and its support is weak in some areas. Be careful with implementation of any XML project
by testing your work thoroughly.
WEB RESOURCE
http://www.xml.co.za
Page | 20
WEB TECHNOLOGY 511
The following table shows the difference between XML and HTML:
XML HTML
User definable tags Defined set of tags designed for web
display
Content driven Format driven
End tags required for well-formed End tags not required
documents
Quotes required around attributes values Quotes not required
Slash required in empty tags Slash not required
by requiring the latest browser. This design strategy can result in visually exciting and
interactive sites that keep pace with the latest technology. Often the user must not
only have the latest browser version, but plug-in enhancements that render certain
media types, such as Macromedia Flash animations. Plug-ins are helper applications
that assist a browser in rendering a special effect. Without the plug-in, your user will
not see the results of your work. Often when a new browser is released, these plug-
ins are included for the most widely adopted enhancements. The risk these cutting-
edge sites take is that many users may not be able to see the content as it was
designed. Sites that use the latest enhancements also may require significant
download times for the special effects to load on the user’s computer. Sites that adopt
the latest technologies must make sure that their user is up to the browser challenge.
Otherwise, their information may go unread.
Browser-specific coding: how many times have you visited a site that states
“This site is best viewed with Internet Explorer 10”? This statement warns you that the
author has decided to forgo the challenge of coding for multiple browsers. The author
may have wanted to use some unique enhancement for the site, or may have found
that the site did not render properly in other browsers. This may seem the most
expedient coding method to adopt. Consider the consequences, however. A site
Page | 21
WEB TECHNOLOGY 511
coded for only one browser may alienate a significant number of readers who
immediately leave because they do not have the correct browser.
2.5 BUILDING A WEB SITE DEVELOPMENT TEAM
Although one person can maintain small Web sites, larger sites require a group of
personnel filling a variety of roles. The line can be blurred between the roles, and of
course, many aspects of site design require more than one head to solve a problem.
The following roles are examples of the types of talent necessary to build a larger,
well-conceived site.
Server administrators - Get to know and appreciate the technical people that
run your Web server. They take care of the sticky technical issues like firewalls,
modem ports, internal security, file administration, and back-up procedures. Consult
with them to determine your Web site’s default filename and directory structure.
They also can generate reports that will tell you how many visitors your site is
attracting, where the visitors are coming from, and what pages they like best.
HTML coders - These are the people responsible for creating the HTML code
and troubleshooting the site. Most HTML coders now are using HTML editors to
create code, but any self-respecting HTML coder knows how to open the HTML file in
a text editor and code by hand. The coders also are responsible for testing and
evaluating the site across different operating systems and Web browsers.
Designers - Designers are the graphic artists responsible for the look of the site.
They will use design software, such as Adobe PhotoShop, the industry standard
graphic design program. Designers contribute to the page template design, navigation
icons, color scheme, and logos. If your site uses photographic content, the designers
will be called upon to prepare the photos for online display.
Writers and Information designers - Writers prepare content for online display,
which includes designing hypertext information and navigation paths. Additionally,
writers should be responsible for creating a site style guide and typographic
conventions. The writers are responsible for consistency, grammar, spelling, and
tone. They also work closely with the designers to develop the page templates.
TWO| INTRODUCTION TO HTML
Page | 22
WEB TECHNOLOGY 511
CSS:a style sheet language used for describing the look and formatting of a
document written in a markup language.
Uniform Resource Locator (URL): refer to section 1
Web page: a hypertext document connected to the World Wide Web
Web Site: a location connected to the Internet that maintains one or more web
pages.
WYSIWYG: denoting the representation of text on-screen in a form exactly
corresponding to its appearance on a printout.
XML: a markup language that defines a set of rules for encoding documents in a
format that is both human-readable and machine-readable.
TWO| GLOSSARY OF TERMS
Page | 23
WEB TECHNOLOGY 511
1.2If web page styles are defined using CSS, which language is used to create
the actual web page and link it with a style sheet file?
A. XML
B. PHP
C. MySQL
D. HTML
1.4What is an element?
A. an individual component of an HTML document or web page
B. Solid head absorber
C. A paragraph
D. A section with headings only
1.5What is a difference between XML and HTML
A. XML is easy, HTML is not
B. XML is content driven, while HTML is format driven
C. XML is similar to HTML
D. XML has defined set of tags designed for web display and HTML uses
user defined tags
1.6What is hypertext?
A. A non-linear way of organizing information
B. A file created to sort files
C. A language used to design web pages
D. A sequence in which files are stored and designed
1.7Who created HTML?
A. Tim Berners-Lee
B. Bill Gate
C. Steve Jobs
Page | 24
WEB TECHNOLOGY 511
D. Sam Sung
1.8 CSS stands for?
A. Cascading Style Source
B. Cascading style Sheet
C. Cascading System Sheet
D. Cascading Style Storage
1.9HTML is cross-platform, what does that mean?
A. HTML is using a cable to display 2 platforms
B. HTML files can be created and viewed on any computer platform
C. HTML is only used when using one platform
D. HTML is a hybrid language
1.10 What does WYSIWYG stand for?
A. Wizy Wig
B. What You See Is What You Get
C. What You Say Is What You Get
D. What You Sign Is What You Get
TWO| REVIEW MULTIPLE CHOICE QUESTIONS
Page | 25
WEB TECHNOLOGY 511
THREE|HTML BASICS
Learning Outcomes
INTRODUCTION
You can explore the Web either by clicking hyperlinks or by using the address bar on
your browser. You use the address bar for specifying the address of a Web page,
which is called a Uniform Resource Locator, or URL.
3.1 UNIFORM RESOURCE LOCATOR
To identify a particular page or document on the Internet you need an Internet
address called a UniformResourceLocator, or URL. A URL consists of three major
components that provide the necessary information to find a specific document.
These components are separated by a forward
slash (/). For example, the URL for PC Training
and Business College Website might be as
follows:
http://www.pctbc.co.za where:
Research http:// is a protocol used.
www.pctbc.co.za/ is the host
How can you register a domain? name and domain of the server.
site/…… is the directory path where the page
is stored. The path might also include file names.
include file names.
THREE| HTML BASICS
THINK POINT
What is an advantage of using
company name as part of your
URL?
Page | 26
WEB TECHNOLOGY 511
Exhibit 0-2: The home page of PC Training and Business College Web site
Browsing the Web
Page | 27
WEB TECHNOLOGY 511
<HTML> is the starting tag and </HTML> is the ending tag. Without these tags the
browser will misinterpret the document as a text file. An HTML document is divided
into two sections—head and body.
HEAD: The head section of an HTML document starts with the
<HEAD> tag and ends with the </HEAD> tag. You can specify the title of the page in
this section by using the TITLE tag (title). The syntax for using the HEAD and TITLE tags
is:
THREE| HTML BASICS
The TITLE tag marks the enclosed text as the title of the page. This title appears on the
title bar of the browser as shown in Error! Reference source not found.2.
BODY: The body section starts with the <BODY> tag and ends with the </BODY>
tag. This section contains the text that appears in the browser window and also
contains other tags in the HTML document. The syntax for using the BODY tag is:
Page | 28
WEB TECHNOLOGY 511
Enter the following code: This tag indicates the end of an HTML
</HTML> document.
Place the insertion point as shown
To prepare to add the starting HEAD
tag.
Press Enter To move the insertion point to the next
line to add the ending HEAD tag.
Press enter To move the insertion point to the next
line to add the starting BODY tag.
Enter the following code: This is the starting BODY tag that
indicates the beginning of the body
<BODY> section.
THREE| HTML BASICS
Page | 29
WEB TECHNOLOGY 511
Choose File, Save As… To display the Save As dialog box. You’ll
save the HTML document in the current
unit folder.
In the File name box, enter To specify the name of the document
Mypage.html and add the .html extension to make it
an HTML document.
Click Save To save the document.
Observe the page The text that you entered between the
TITLE tags appears on the title bar of the
browser window.
Page | 30
WEB TECHNOLOGY 511
Page | 31
WEB TECHNOLOGY 511
Body: HTML section that contains all the content to be displayed to user.
Containers: the area enclosed by the beginning and ending tags.
Source Code: any collection of computer instructions (possibly with comments)
written using some human-readable computer language, usually as text.
Uniform Resource Locator: Refer to topic 1
Read
TRHEE| GLOSSARY OF TERMS
PRESCRIBED TEXTBOOK:
INTERNET & WOZLD WIDE WEB How to Program, 5th Edition, by Paul Deiltel,
Harvey Deitel, Abbey Deitel. Page 122, 128 and 129
http://www.gcflearnfree.org/internet101/1
Page | 32
WEB TECHNOLOGY 511
1.1What are the three document elements that an HTML page must have?
A. HTML, HEAD, BODY
B. HEADING, PARAGRAPH, TITLE
C.TITLE, DATE, COLORS
D.HEAD PARAGRAPH,HYPERLINK
1.2 When creating a web site, the home page is saved as?
A. Home.html
B. Index.html
C. Page1.html
D. Homepage.html
B. <p></p>
C. <div></div>
D. <img>
1.4In which section of an HTML document do you add text that will appear on
A. Body
B. head
C. html
D. none of the above
1.5An HTML document is saved with the following extension.
A. .html
B. .css
C. .php
D. .exe
Page | 33
WEB TECHNOLOGY 511
C. <tittle>
D. <label>
1.9What makes the ending tag differ from starting tag?
A. The ending tag contains a forward slash before the name of the tag.
B. The ending tag is always written in capital letters
C. Ending tag is shorter compared to starting tag
D. They are similar
1.10What are the three main element that an HTML document must have?
A. Head element, body element, title element
B. Html element, head element, body element
C. Html element, head element, paragraph element
D. Only body element
THREE| REVIEW MULTIPLE CHOICE QUESTIONS
Page | 34
WEB TECHNOLOGY 511
Learning Outcomes
INTRODUCTION
Headings and paragraphs have long been used to improve the reading ease and
appearance of all kinds of documents, such as newspapers, books, and reports.
Headings inform the reader what the document is about. You use headings in Web
pages to describe the contents of a page or a section of a page.
You use paragraphs to group information on a page that has a large amount of text.
Using paragraphs increases the readability of the page and makes the information
easily accessible.
KEY POINT
FOUR| HEADINGS AND PARAGRAPHS
4.1 HEADINGS
You use the headingtag to mark headings in a Web page. You can create up to six levels
of headings; Heading 1 (H1) is the first level and Heading 6 (H6) is the last level. Each
heading level appears in a different size. Text marked as Heading 1 appears bigger in
size as compared to text marked as Heading 6. The syntax for marking text as Heading
1 is:
<h_level>some text</h_level>
Page | 35
Example
The H1 tag is a container with <H1> as its starting tag and </H1> as it’s ending tag.
You can mark text as any of the heading levels, such as Heading 2 (H2) or Heading 3
(H3), in a similar manner.
Creating headings
4.2 PARAGRAPHS
In a page that contains a large amount of text, you can separate text into different paragraphs by using
the Ptag (paragraph), which has the following syntax:
<P>Paragraph text</P>
<P> denotes the start and </P> indicates the end of a paragraph. The P tag leaves a blank line before the
next text.
Page | 36
WEB TECHNOLOGY 511
Example
Line breaks
To make some text appear on a new line you can use the BRtag (line break), which
has the following syntax:
<BR>
The BR tag is an empty container. You can also
use this tag to insert a blank line on a page.
The BR tag moves text to the next line, while
the P tag (paragraph) leaves one blank line
WEB RESOURCE between texts on the page as shown in Exhibit
0-3.
http://www.w3schools.com/tag
s/tag_br.asp
FOUR| HEADINGS AND PARAGRAPHS
Page | 38
Here’s how Here’s why
Observe the page The text on this page is continuous
without any line breaks.
Open the source code You’ll create a paragraph on this page.
Creating paragraphs and
Place the insertion point as shown
inserting line breaks
To prepare to add the code to mark
the text as a paragraph.
Enter the following code: To mark the beginning of a paragraph.
<P>
Place the insertion point as shown
Page | 39
WEB TECHNOLOGY 511
4.3 COMMENTS
In HTML a comment (or comments) is information a designer can add to the HTML
source code for reference. Comments are not viewed by the user or displayed on
the web browser, but only when viewing the HTML source code. HTML allows you
to add comments within the code to help the reader better understand the code.
To add a comment to the code for a page, use the following code:<!-- comments--
>
Adding comments
FOUR| HEADINGS AND PARAGRAPHS
Page | 40
Here’s how Here’s why
Open the source code You’ll add comments in this code.
Place the insertion point as shown
The ampersand (&) indicates the beginning and the semi-colon (;) indicates the end of a
character entity.
You can modify the appearance of a page by adding formatting tags to its source code. You
format a page by specifying the color for the text, underlining or italicizing the text, or making
it bold. Browsers determine a specific format and the text formatted by using these
formatting tags might appear different on different browsers. The following table lists some
of the formatting tags and their function.
Here’s how Here’s why
Open the source code You’ll add a character entity to this
page.
Place the insertion point as shown
Page | 42
WEB TECHNOLOGY 511
Tag Function
<B></B> Makes the text enclosed within these tags bold.
<I></I> Italicizes the text enclosed within these tags.
<U></U> Underlines the text enclosed within these tags.
Attributes
Attributes of a tag provide additional features to a tag. You specify attributes within
the starting tag. The syntax for using an attribute is:
<Tag_name attribute_name=value>
In HTML, there are attributes which are known as global attributes. These attributes
can be used on any HTML element/tag. The following table contains a list of mostly
used global attributes and their description.
Attribute Description
class Specifies one or more class names for an element (refers to a class
in style sheet).
id Specifies a unique id for an element.
style Specifies an inline CSS style for an element.
title Specifies extra information about an element.
As a web designer/developer, you must be able to use attributes and know the list
of attributes that are applicable on each tag. The following table contains a list of the
<body> tag attributes:
FOUR| HEADINGS AND PARAGRAPHS
Attribute Description
alink Specifies the color of an active link in a document.
background Specifies a background image for a document.
link Specifies the color of unvisited links in a document.
4.6 ALIGNMENT
You align a heading to enhance the appearance of a page and make it look different
from the rest of the text on the page. CSS allows you to align any element anywhere
within a Web page.
By default, all Web page content appears on the left on the page. You can use the
ALIGN attribute with various tags to force text to appear in the center or on the right.
This attribute will align headings or paragraphs. For example, you might want to align
the heading to the center of the page. The syntax for using the ALIGN attribute to do
this is:
<H1 ALIGN=Center>PCTBC student Web Page</H1>
The ALIGN attribute used within the H1 tag centers the heading on the page. You can
use this attribute within the P tag to align a paragraph.
Page | 43
WEB TECHNOLOGY 511
tag. This tag also supports the global attributes in HTML. The syntax for using the
<blockquote> tag is:
<blockquote> Desired text </blockquote>
Exhibit 0-4: The page with the heading centered and text indented
4.7 USING HORIZONTAL RULERS
You can divide the text on a page into different sections by inserting a horizontal rule
to increase the readability of the page. Inserting a horizontal rule creates a dividing
line on a page as shown in
FOUR| HEADINGS AND PARAGRAPHS
Page | 44
FOUR| HEADINGS AND PARAGRAPHS
Page | 45
WEB TECHNOLOGY 511
WEB TECHNOLOGY 511
Attributes of a
horizontal rule Here’s how Here’s why
You can format a
horizontal rule to Open the source code You’ll insert a horizontal rule on this
make it wider, page.
thicker, or appear in Place the insertion point as shown
a different color by
using several
To prepare to add the code to insert a
attributes of the HR
horizontal rule on the page.
tag. The following
Enter the following code: To insert a horizontal rule on the page.
table lists the
<HR>
attributes of the HR
tag. Update and close the source code
Refresh the page
Observe the page A horizontal rule appears on the page.
Attribute Description
WIDTH Allows you to specify the length of the horizontal rule as a
percentage of the width of the browser window. For
example, you decrease the horizontal rule to 90% of the
width of the browser window by using the following code:
<HR WIDTH=90%>
COLOR Allows you to specify the color of the horizontal rule.
You make the horizontal rule appear blue by using the
following code:
<HR COLOR=Blue>
Page | 47
WEB TECHNOLOGY 511
Page | 48
WEB TECHNOLOGY 511
1.4Which attribute would you use to increase thickness of the horizontal line
that appears on a web page?
A. width
B. height
C. thickness
D. size
1.5This is an HTML5 entity for the “&” character.
FOUR| REVIEW QUESTIONS
A. &AND;
B. &
C. >
D. %EMPER;
Page | 49
WEB TECHNOLOGY 511
A. &LESS;
B. <
C. <E;
D. &>;
1.9What is the use of the line break tag?
A. To make text appear on a new line
B. To create a space between text in one line
C. To break a line and add new image
D. None of the above
1.10This is the heading level with largest font size.
A. H1
B. H6
C. H20
D. Hlarge
FOUR| REVIEW QUESTIONS
Page | 50
WEB TECHNOLOGY 511
FIVE|HYPERLINKS
Learning Outcomes
INTRODUCTION
A Web site is a collection of Web pages that can contain text, graphics, animation,
sound, and a variety of interactive elements. Information on the Web is organized on
many pages across many sites. You can access information on the Web easily if you
can move quickly and effortlessly from one location to another. Hyperlinks allow you
to navigate through the Web.
5.1 HYPERLINKS
A hyperlink generally appears underlined on a page. When you point to a hyperlink,
the pointer change to a hand and the address of the resource to which
it links appears on the status bar of the browser. This address can be
a URL of a Web site, the address of a page within your Web site, or
any other resource, such as a graphic, sound, or movie file. Clicking
the hyperlink displays the linked page in the browser. By default, a
KEY hyperlink will be underlined and blue in color when displayed on the
Web browser.
POINT
Observing hyperlinks
Hyperlinks
are used to
link two or
more html
Here’s how Here’s why
Indocuments
the browser, open Facts (From the current unit folder.) This page
/files in a gives the list <hr> attributes and has a
FIVE| HYPERLINKS
Page | 51
WEB TECHNOLOGY 511
Where page_name will be the name of the Web page you want to link to and Click
Here will be the hyperlink.
e.g. <a href=”home.html”>Go to homepage</a>
home.html is the file to which the link points. When you click the text “Click here,”
home.html appears in the browser. If you want to link to a file that is stored in a
subdirectory, the value assigned to the HREF attribute will be the path of that file with
respect to the current directory.
contains the basic information about the Web site. However, to locate the description
or any other information, you’ll have to scroll extensively. To avoid this, you can
create hyperlinks that link to these descriptions by using the name and href attributes
of the <a> tag. The point in the document to which you want to link is the target
address. To create a target address on the page, use the name attribute as shown in
the following code:
<a name = "topic">Welcome to my page</a>
To create a hyperlink to this target, use the following code:
<a href = "#topic">Back to intro</a>
Page | 53
WEB TECHNOLOGY 511
Page | 54
WEB TECHNOLOGY 511
Read
PRESCRIBED TEXTBOOK:
INTERNET & WORLD WIDE WEB How to Program, 5th Edition, by Paul Deiltel,
Harvey Deitel, Abbey Deitel. Page 74
http://www.gcflearnfree.org/internet101/1
FIVE|GLOSSARY
FIVE| OF TERMS
REVIEW QUESTIONS
Page | 55
SECTION 5 REVIEW QUESTIONS
WEB TECHNOLOGY 511
1.1Which attribute is used to specify a page that will be opened when a hyperlink is clicked
A. href
B. alt
C. target
D. src
1.2Which attribute can you use to display a page in a new browser tab?
A. new
B. target
C. destination
D. final
1.3What is a website?
A. Collection of networks that are online
B. Collection of web pages that are linked
C. A place in which web pages are stored
D. A collection of information and music
Page | 56
WEB TECHNOLOGY 511
Page | 57
WEB TECHNOLOGY 511
SIX|IMAGES AND BACKGROUNDS
LEARNING OUTCOMES
Enter the following code: To add the image Logo.gif to the page. The ALIGN
<IMG SRC="Logo.gif" attribute of the P tag aligns the image to the center of
alt=”PCTBC” align=”center”> the page. The SRC attribute of the IMG tag specifies
the path of the image file on the computer. The alt
attribute represents alternative text which will be
displayed if an image is not found.
Update and close the source code
Refresh and observe the page The logo appears on the page and is centred.
Link Borders
When using an image as a hyperlink, a blue border is displayed around an image. By default,
most web browsers will display a border around graphic links indicating the link color. To
remove this border or want to make it bigger, you can use the border attribute in your <img>
tag. The following code uses border attribute:
<a href="images.html"><img src="img1.png" border=”1” alt=”image
1”></a>
WEB TECHNOLOGY 511
To align the text around an image you use the align attribute of the <img> tag. Top,
Middle, and Bottom are the possible values for the align attribute.
To align text to the top of the image img1.png, use the following code:
<img src="img1.png" align=”Top” alt=”image 1”>
Link Borders
When using an image as a hyperlink, a blue border is displayed around an image. By
default, most web browsers will display a border around graphic links indicating the
link color. To remove this border or want to make it bigger, you can use the border
attribute in your <img> tag. The following code uses border attribute:
<a href="images.html"><img src="img1.png" border=”1” alt=”image 1”></a>
SIX| IMAGES AND BACKGROUNDS
Page | 59
WEB TECHNOLOGY 511
Enter the following code: To make the graphic logo.gif a hyperlink to the
<A HREF="PCTBC.html"> PCTBC.html page.
Add the ending A tag as shown
6.5 BACKGROUNDS
Proper use of background colors and images adds contrast to enhance the
appearance of text and graphics on a page. They can be used to provide a distinct look
to a Web site, which makes it easily identifiable to users.
BACKGROUND COLORS
Page | 60
WEB TECHNOLOGY 511
You add a background color to a page by using the bgcolor attribute of the
<body> tag. To set the background color of a page to red, use the following
code:
<body bgcolor=”red”>
The bgcolor is supported in HTML5 and the recommended way of adding
background color is to use CSS:
<body style=”background-color:red”>
Adding a background color
Here’s how Here’s why
In the browser, open Products You’ll add a background color to this page.
Open the source code
Place the insertion point as
shown
Edit the code to read:
<BODY BGCOLOR=Cornsilk>
Update and close the source code
Refresh and observe the page The page now has cornsilk as its background color.
Color Values
In CSS, colors are defined using hexadecimal (hex) notation for the
combination of Red, Green, Blue color value (RGB). The lowest value that
can be given to one of the light sources is 0 (hex code: 00). The highest value
is 255 (hex code: FF). Hexadecimal value for a color must have a minimum
of 6 character and must always start with the pound (#) sign.
Background images
You can give your Web site a distinct look by adding the same background
image to all pages in your site. You add a background image to a page by
using the backgroundattribute of the <body> tag. To add the image
Background.gif to the background of a page, use the following code:
<body background="Background.gif">
When both the background color and the background image are set for a
page, only the background image appears on the page. If the background
image is not found in the specified folder, the background color appears.
The background attribute is not supported in HTML5 and the recommended
method of using an image as a background is as follows:
<body style=”background-image:url(Background.gif);">
Page | 61
WEB TECHNOLOGY 511
Page | 62
WEB TECHNOLOGY 511
Graphical Interchange Format (GIF):a lossless format for image files that supports
both animated and static images.
Joint Photographic Experts Group (JPEG): a commonly used method of glossy
compression for digital images, particularly for those images produced by digital
photography.
Image:a representation of the external form of a person or thing in art.
Read
PRESCRIBED TEXTBOOK:
INTERNET & WORLD WIDE WEB How to Program, 5th Edition, by Paul Deiltel,
Harvey Deitel, Abbey Deitel. Page 77 and 152
http://www.gcflearnfree.org/internet101/1
SIX| GLOSSARY OF TERMS
Page | 63
WEB TECHNOLOGY 511
1.1 Which attribute is used to specify text that appears if an image is not
available?
A. alt
B. lte
C. text
D. title
1.4 How can you remove the border that appears around an image if an image
is used as a hyperlink?
A. By using the border attribute of the img tag
B. By using the border attribute of the anchor tag
C. You can simply create a table before adding an image
D. You can use two images.\
SIX| REVIEW QUESTIONS
1.5 How can you use an image as background of a web page using css?
A. <body style=background-image:url(‘image.jpg’); alt=”My image”>
B. <body style=”image:image1.jpg” alt=”My image”>
C. <body background-image=”image.jpg” alt=”My image”>
D. None of the above
1.6 This is a commonly used image format because all browsers support it.
A. .pxr
B. .jpg
C. .bmp
D. .gif
1.7A web page becomes more attractive if it has colors and images. Which
body attribute can you use to add background color on your web page?
A. bgcolor
B. background
C. color
Page | 64
WEB TECHNOLOGY 511
D. wallpaper
1.8 The hexadecimal code for black is _______________.
A. #111111
B. #FFFFFF
C. #000000
D. #F4F4F4
1.9In colors, RGB stands for?
A. Red, Green, Black
B. Red, Green, Blue
C. Red, Grey, Black
D. Red, Gray, Black
1.10 The following property watermarks a background image if used.
A. bgproperty
B. bgstable
C. bglocation
D. brwatermark
SIX| REVIEW QUESTIONS
Page | 65
WEB TECHNOLOGY 511
SEVEN|TABLES
LEARNING OUTCOMES
1. Create a table, set the border and width of a table, add headings
to a table
2. Span cells across rows and columns, align a table and data in a cell,
insert images and hyperlinks in a table, and add comments to the
code of a page
3. Create a nested table to organize the information on a page
INTRODUCTION
Presenting data in a table format is an effective way of organizing, displaying, and
accessing complex information. For instance, a list of products and their prices is best
depicted as a table.
7.1 TABLES
A table is composed of rows (from left to right) and columns (from top to bottom)
with data contained in individual cells. A cell is an intersection of a row and a column.
In HTML, you can create a table by using the tags shown below.
Tag Description
<table></table> These are the primary tags, which surround the rest of the text
and code within a table.
<tr></tr> Defines each row in a table.
<td></td> Indicates the beginning and ending of a cell in a table.
Error! Reference source not found., using the code shown in Exhibit 0-7.
SEVEN| TABLES
Exhibit 0-7: The source code of the Student register page after creating a table
Page | 66
WEB TECHNOLOGY 511
BORDER attribute
A border around a table gives it a three-dimensional look. You set the border of a
table by using the border attribute of the <table> tag. To set the border of a table,
use the following code:
<table border>
By default, the width of the border is set to 1 pixel. You can increase the width of the
border by setting different values to the attribute. To set the width of the border to
2 pixels, use the following code:
<table border=”2”>
WIDTH and HEIGHT attributes
By default, the width of a table depends on the length of the text. However, you can
change the width by using the width attribute of the <table> tag.
You can specify the width in pixels or as a percentage value. If you specify the width
in pixels, the size of the table remains fixed. When you specify the width as a
percentage, the width of the table will vary based on the size of the browser window.
To set the width of a table to 50% of the browser window’s width, use the following
code:
<table width=”50%”>
You can set the height of a table in a similar manner by using the height attribute of
the <table> tag.
IDEA
The text enclosed within the <th> tag appears bold and centered. This helps to
identify the text as a heading of a column.
Exhibit 0-8: The use of the <th> tag to create a table heading
7.4 SPANNING A CELL
Spanning cells across rows and columns allows you to display grouped information in
a table. The COLSPAN or ROWSPAN attribute is used with the <td> tag to determine
the number of columns or rows you want to span. To span a cell across three columns,
use the following code:
You can also span a cell across two or more rows by using the ROWSPAN attribute.
Page | 68
WEB TECHNOLOGY 511
Exhibit 0-10: The use of ALIGN attribute to align data within the cells (surname)
7.6 IMAGES AND LINKS WITHIN CELLS
Adding images to a table breaks the monotony of text and communicates the
information clearly. You use the <img> tag to add images to a table, just as you would
anywhere else in an HTML file. You can add hyperlinks within a table when you
cannot provide all relevant information within the table. You use the <a> tag to add
a hyperlink within a cell as you would add any hyperlink on a page.
SEVEN| TABLES
Page | 69
WEB TECHNOLOGY 511
Page | 70
WEB TECHNOLOGY 511
Nested tables
You use nested tables to add additional information within a table. They are used to
display information that is useful but not necessary. To create a nested table, put the
code required for a table within a pair of <td> tags in another table. For example, you
can display a calorie chart within a table for an apple pie recipe.
Exhibit 0-11: The source code of the Applepie page with a nested table
Exhibit 0-12: A cell of the table on the Applepie page containing another table
SEVEN| TABLES
Page | 71
WEB TECHNOLOGY 511
Cell:a non-empty element and should always be closed. It is one grouping within
a table. Cells are grouped horizontally (rows of cells) and vertically (columns
of cells).
Column:a set of data values of a particular simple type, one for each row of the table.
The columns provide the structure according to which the rows are composed.
Row:represents a single, implicitly structured data item in a table.
Table: a set of data elements (values) using a model of vertical columns (which are
identified by their name) and horizontal rows, the cell being the unit where a row
and column intersect.
Read
PRESCRIBED TEXTBOOK:
INTERNET & WORLD WIDE WEB How to Program, 5th Edition, by Paul Deiltel,
Harvey Deitel, Abbey Deitel. Page 86
SEVEN| GLOSSARY OF TERMS
http://www.gcflearnfree.org/internet101/1
Page | 72
WEB TECHNOLOGY 511
Page | 73
WEB TECHNOLOGY 511
1.2 When creating a table, the border is set to zero by default. Is this statement
true or false?
A. True
B. False
C. Depends on HTML version
D. Depends on table width
1.3 If you want a cell to span multiple columns, which attribute can be used?
A. rowspan
B. colspan
C. cellspan
D. span
1.4 A cell can span multiple rows and columns. How can you make a cell span
multiple rows?
A. By using rowspan attribute
B. By using the cellheight attribute
C. By using one cell per row
D. By creating a new table
SEVEN| REVIEW QUESTIONS
1.6 A table can have headings. In html, which tag can be used to add table
headings?
A. <heading>
B. <h1>
C. <th>
D. <thead>
1.7What is a difference between a cell and a table?
A. A cell is where a row and a column intersect and a table is made up of
rows and columns.
B. A cell is bigger than a table.
Page | 74
WEB TECHNOLOGY 511
Page | 75
WEB TECHNOLOGY 511
EIGHT|STYLE SHEETS
LEARNING OUTCOMES
INTRODUCTION
Style sheets allow you to separate the content of a page from its design
(separating structure from style). A style sheet is a set of rules that define the
formatting of HTML tags on a page. Using style sheets, you can control how a
Web site is rendered, including the margins, indents, and text backgrounds
without changing the HTML code for any page. The most recent CSS version is
CSS3. When using style sheets, styles define how to display HTML elements.
8.1 STYLE SHEETS
Style sheets not only provide a consistent design to pages in your Web site but
also make pages faster to load and easier to read. You can use style sheets in
three ways, depending on your design needs:
Inline styles to the code for a Web page. This method allows you to change
the format of a single tag on a page.
Embed a style sheet in the code for a Web page. This method allows you
embed the code for the style sheet within a Web page.
Link a style sheet to a Web page. This method allows you to link your Web
page to an external file that contains style definitions. You can link multiple
pages to this file to maintain a consistent look for all pages.
CSS syntax
Before we continue with the ways in which we can use style sheet, we have to
know the CSS syntax. A CSS rule consist of a selector and a declaration block:
Syntax:
selector{property: value; property: value;}
for example:
body{color:red; font-size:22pt;}
EIGHT| STYLE SHEETS
This will change the text color and size of a web page to specified values (red,
22)
When using the css syntax, you start with a selector. CSS selectors allow yo to
select and manipulate HTML elements.
There are three general types of selectors in css:
element selector
The element selector selects elements based on the element name. This means
when defining an element selector, an element/tag is used as a selector.
e.g. a{color:green;}
This will change any color of the text that is between <a> and </a>
Page | 76
WEB TECHNOLOGY 511
A CSS style defined using an element selector will be applied automatically whenever
an elemnt/tag is used.
id selector
The id selector uses the id attribute of an HTML tag to find the specific element. This
means to apply a CSS style defined using an id selector, an id (which must be unique)
of an element is used. To create an id
selector, you start with a hash character
followed by the id of an element.
e.g. #mylink{text-decoration:none;}
IDEA This will affect an element with an id
“mylink” only. For example:
Selectors are only used when <a id=”mylink”
using embedded or linked style href=”page.html”>Page1 </a>
sheet. class selector
The class selector finds elements with the
specific class. To create a class selector, you have to start with a period(.) followed by
the class name. for example:
.fontChanger{font-size:20pt; color: green;}
To apply CSS rude defined using a class selector, the class attribute must be used
within an element. The class attribute can take more than one value. This means an
element can have two or more classes. For example:
<p class=”fontChanger otherClass”>paragraph text </p>
When using css, you must know different css property and their possible values.
Inline styles
Inline styles affect the individual occurrences of a tag. You can define several
properties for a tag by using the STYLE attribute. Each property is identified by the
property name, followed by a colon and the property value. To make text enclosed
within an H2 tag green, use the following code:
<h2 style="color:Green">About us</H2>
In the code, the COLOR property has the value Green.
If you use another H2 tag in the same page without specifying an inline style, the
enclosed text will appear in the default H2 format. When using inline style, the
selectors are not used, instead, the style
attribute is used.
EIGHT| STYLE SHEETS
Page | 77
WEB TECHNOLOGY 511
followed by a colon and the property value and a semi-colon after each value. Unlike inline style,
embedded style requires the use of CSS syntax. This means you have to also define selectors.
To create an embedded style that renders text enclosed within the <h2> tags as green and in the Verdana
font, use the following code:
<HEAD>
<STYLE>
H2 {
COLOR: Green;
FONT-FAMILY: Verdana;
}
</STYLE>
</HEAD>
Now, whenever you use an H2 tag in the page the enclosed text will appear green and in Verdana.
Defining a class
When you define an embedded style for a tag, you can no longer use the default style of the tag on your
Web page. To be able to do so, you can define a class for the tag instead. A class allows you to apply
several formatting styles for different occurrences of the same tag. A class definition starts with a period
(.) followed by a name and the style definition.
To create a class that defines the color of text enclosed as blue, use the following code:
<style>
.Blue
{
COLOR:Blue;
}
</style>
You can now use this class with any tag such as, the H1 tag, the P tag, or the B tag to change the color of
the text. You can assign the class to a tag by using the class attribute. To assign the Blue class to a <b> tag,
use the following code:
<b class="Blue">
You can create a class for a particular tag by specifying the name of the tag with the class definition. For
instance, to create a class named “Red” for the <h2> tag to set the color of text marked as heading 2 to
Red, use the following code:
H2.Red
{
COLOR:Red;
}
Next, you assign the class “Red” to the <h2> tag that encloses the text that should appear red. To do this,
enter the following code in the <h2> tag:
<h2 class="Red">
8.3 DIV and SPAN TAGS
The <div> tag is a formatting tag that you use to apply styles to blocks of text on a page. It can be used to
apply styles to sections of a page, such as text enclosed within the <blockquote> tags. You can use both
the style and the class attribute with this tag. To set a background color of a paragraph to light green, use
the following code:
<div style="background: Lightgreen;">
<p>
Paragraph text
</p>
Page | 78
WEB TECHNOLOGY 511
</div>
The <div> tag defines the style for the complete block and leaves space above and
below each block, like the <p> tag.
SPAN tag
The <span> tag is a formatting tag that allows you to set styles around text in page.
It functions like any other text formatting tag, such as the <b> tag. You can use both
style and class attributes with this tag. To set a background color to a part of text
on a line, use the following code:
<span style="background: Lightgreen">
Desired text
</span>
8.4 LINKED STYLES
Linked style sheets are one of the most powerful ways to use styles on your Web
pages. They provide the ability to create one style sheet that affects multiple pages.
You can change the entire look of your site by modifying just a few lines of code in
a single style sheet.
Linked style sheets
A linked style sheet is an external file that contains only the style definitions as
defined within the <style> tag in embedded style sheets. The external file has a .css
extension. You can link all pages of your site to this file to maintain a consistent
look of your site. For instance, set the <h2> tag to appear green in color in a style
sheet and link all pages of your site to this file. All pages in the site that use the
<h2> tag will display the enclosed text green.
The href attribute of the <link> tag is the same as the href attribute of the <a> tag
that specifies the path and name of the style sheet. You can link to more than one
style sheet by using more Link tags.
Page | 79
WEB TECHNOLOGY 511
Exhibit 0-13: The student register page after linking it to the style sheet style.css
Creating a style sheet and linking it to a page
Here’s how Here’s why
Open Notepad Choose Start, Programs, Accessories, Notepad.
Enter the code as shown
black.
Open the source code
Place the insertion point as
shown
To prepare to add the LINK tag to link this page to
the style sheet.
Enter the following code: To link this page to the style sheet, Linked-style, to
format this page based on the styles specified in
<LINK REL="stylesheet" the style sheet.
HREF="style.css">
Update and close the source code
Refresh and observe the page The page now has a background color. The color
of the heading “Our expansion project” has
changed to red, and the text that is enclosed
Page | 80
WEB TECHNOLOGY 511
THINK POINT
Using CSS, which property can
you use to create a 3 columns in
a division? Give example
Page | 81
WEB TECHNOLOGY 511
Cascading order:refers how browsers determine which style rules to follow when
there are conflicting rules.
Cascading Style Sheet:a style sheet language used for describing the look and
formatting of a document written in a markup language.
Class Selector:is a name preceded by a full stop (“.”)
Division:a container unit that encapsulates other page elements and divides
the HTML document into sections.
ID Selector:a name preceded by a hash character (“#”).
Inline Style sheet: A specific style inclusion method, in which style information is
directly attached to the HTML elements they affect.
Property:define what aspect of the selector will be changed or styled.
Selector:the part of a CSS rule set that actually selects the content you want to
style.
Read
PRESCRIBED TEXTBOOK:
INTERNET & WORLD WIDE WEB How to Program, 5th Edition, by Paul Deiltel,
Harvey Deitel, Abbey Deitel. Page 175
http://www.gcflearnfree.org/internet101/1
EIGHT| STYLE SHEETS
Page | 82
WEB TECHNOLOGY 511
1.3Which pseudo class can be used to define a style for a visited hyperlink?
A. A visited
B. Link-style
C. Link-visited
D. a:visited
E[attr]
A. Selects all E elements that have the given attribute attr
B. This is invalid
C. It will select all elements in a document
D. None of the above
1.6The following CSS3 pseudo element select will select the first line of an
element.
A. <first_line
B. :first_line
C. ::first-line
D. >first_line
1.7How can you link a web page with a CSS file?
A. <link rel=”stylesheet” href=”file.css” />
B. <link rel=”css” href=”file.css” />
C. <link type=”stylesheet” href=”file.css” />
D. <a href=”file.css”>
Page | 83
WEB TECHNOLOGY 511
1.8 An element was styled using linked, embedded and inline style sheet.
Which style is most likely to be displayed?
A. All styles will be displayed
B. Inline style
C. Embedded style sheet
D. Linked style sheet
1.9Which pseudo element can one use to define that will appear if a user
places a mouse over an element?
A. :over
B. :hover
C. :mouseover
D. :top
1.10 Which formatting tag can one use to apply styles to blocks of text on a
page?
A. <div></div>
B. <span></span>
C. <p></p>
D. <style></style>
EIGHT| REVIEW MULTIPLE CHOICE QUESTIONS
Page | 84
WEB TECHNOLOGY 511
NINE|FORMS
LEARNING OUTCOMES
INTRODUCTION
In general, if you want to collect vital information about someone or something, the
form is used. What if you want to create a Web page which will collect data from the
user? You can collect data from the users of your Web site by using forms. For
instance, you can ask users to fill out forms to specify which products they want to
order. You can also use forms to collect feedback about your site.
9.1 FORMS
You use <form>tags to create a form. This tag encloses the code for all the fields in a
form, such as text boxes, text area, check boxes, radio buttons, and other buttons.
The data of a form is stored and processed in a database on a Web server. You process
the data by assigning the value POST or GET to the METHOD attribute. POST is used
when you want to store the data of the form in the database and GET is used to
retrieve data from the database. You use the ACTIONattribute of the FORM tag to
specify the URL of a program that processes this data.
Creating forms
A form can contain many fields, such as text boxes, text area fields, radio buttons, and
check boxes (see Exhibit 0-14). You use the <input>tag within the FORM tag to create
fields and other elements in a form. This is an empty container. The TYPEattribute of
the INPUT tag allows you to specify the type of the field that you want to add to a
page.
For example, to add a text box, you would use
the following code within the FORM tag:
<INPUT TYPE="text">
IDEA
Page | 85
WEB TECHNOLOGY 511
Tag Description
<form> Defines an TML form for user input
<input> Defines an input control
<textarea> Defines a multiline input control (text
area)
<label> Defines a label for an <input> element
<select> Defines a drop-down list
<option> Defines an option in a drop-down list
<button> Defines a clickable button
NINE| FORMS
Page | 86
WEB TECHNOLOGY 511
The following table lists the values and functions that you can assign to the TYPE attribute.
Value Description
Button Defines a clickable button (mostly used with a JavaScript to
activate a script)
checkbox Defines a checkbox
Color Defines a color picker
Date Defines a date control (year, month and day (no time))
Email Defines a field for an e-mail address
Password Specifies that the field is a text box in which the text is encrypted.
Reset Creates a button that deletes all the data entered in a form.
Button Creates a button that does not have a preset function. It can be
assigned a specific function by using a programming language,
such as JavaScript.
Hidden Indicates that the field will not appear on the page, but the
content of the field is submitted to the Web server.
Image Displays the image specified by the SRC attribute of the INPUT
tag. When you click this image, the data of the form is submitted.
To obtain information from users in the form of text or numbers, you use fields, such as text boxes and
text area. You can allow users to select from a given list of items by using fields such as list boxes, radio
buttons, and check boxes.
Page | 87
WEB TECHNOLOGY 511
Exhibit 0-15: The Order page with a text box and a text area
NINE| FORMS
Page | 88
WEB TECHNOLOGY 511
Page | 89
WEB TECHNOLOGY 511
Exhibit 0-16: The Order page with the list box dropped down
Multiple option list boxes
You might want users to be able to select more than one of the items in a list box.
Users can select multiple items from a list box if they want to buy more than one
product. You use the MULTIPLE attribute of the SELECT tag to create a multiple
option list box. Users can then use the control or shift keys, depending on the
position of items, to select multiple items from the list box.
Here’s how Here’s why
Open the source code
Edit the SELECT tag to read The MULTIPLE attribute indicates that users can
<SELECT NAME=”Spices” select more than one item from the list box.
MULTIPLE>
Update and close the source code
Refresh and observe the page The list appears and displays all the items. Users
can now order more than one item.
From the list, select Cumin
Press c and select “Cumin” and “Green cardamom” are selected.
Green cardamom
To create a group of radio buttons, you give several INPUT tags of the radio type the
NINE|FORMS
same value for the NAME attribute. You can assign a value to a radio button by using
the VALUE attribute. For instance, to provide the options “AMEX“ and “VISA” as
radio buttons, you would use the following code:
<INPUT TYPE="radio" NAME="Payment" VALUE="Amex">AMEX
NINE|
Attribute Description
NAME Specifies the name of the group of the check box.
VALUE Specifies the value that is sent to the database when the check
box is checked.
CHECKED Indicates that the check box is checked by default.
<INPUT TYPE=“checkbox” of all the check boxes. Here, “Outlets” is the name
NAME=“Outlets” of the group of check boxes. The VALUE attribute
VALUE=“Outlet1”> specifies that the value “Outlet1” will be
Sh submitted to the database if this check box is
opper’s Paradise checked.
Page | 92
WEB TECHNOLOGY 511
<INPUT TYPE=”submit”
VALUE=“Order now”>
Update and close the source code
Refresh and observe the The button now has the label “Order now.”
page
Open the source code You’ll specify the action to be taken when the
NINE| FORMS
Page | 93
WEB TECHNOLOGY 511
Exhibit 0-19: The submit and reset buttons on the Order page
Here’s how Here’s why
Open the source code
Place the insertion point as
shown
Enter the code The value “reset” assigned to the TYPE attribute
creates a reset button. When users click the
<INPUT TYPE=”reset” reset button, all the field entries in the form are
VALUE=”Clear form”> deleted.
Update and close the source code
Refresh and observe the page Another button with the label “Clear form”
appears on the page (see Exhibit 0-19).
Enter values in all the fields of the from
Click Clear form The data in all the fields of the form is reset to
the original status.
NINE| FORMS
Page | 94
WEB TECHNOLOGY 511
Check box: An element used when you want to let the visitor select one or more
options from a set of alternatives.
Form: allows a user to enter data that is sent to a server for processing. Forms can
resemble paper or database forms because web users fill out the forms using
checkboxes, radio buttons, or text fields.
Radio Button:a graphical control element that allows the user to choose only one of
a predefined set of options
Text area: A text field that can span several lines.
Read
PRESCRIBED TEXTBOOK:
INTERNET & WORLD WIDE WEB How to Program, 5th Edition, by Paul Deiltel,
Harvey Deitel, Abbey Deitel. Page 90
NINE| GLOSSARY OF TERMS
http://www.gcflearnfree.org/internet101/1
Page | 95
WEB TECHNOLOGY 511
1.1. How can you collect feedback from visitors of your web site?
A. By using fast mail
B. By using forms
C. By visiting each and every web site visitor/user
D. None of the above
1.3Which input control in a form that allows a user to select only one option?
A. Check box
B. Text box
C. Text area
D. Radio button
1.5To create a button that will reset a form, the following code can be used:
A. <reset></reset>
B. <input type=”reset” value=”Refresh” />
C. <input type=”refresh” value=”reset” />
D. None of the above
Page | 96
WEB TECHNOLOGY 511
1.8 A form can be reseted. This can be done by creating a ______ button.
A. clear
B. refresh
C. reset
D. new
1.9When the type attribute of an input tag is equal to hidden. What will be
created.
A. An element with a value that will not be used.
B. A field that will not appear on the page but the content will be
a. submitted to the web server
C. An input element with no data
D. A hidden box
1.10 To specify the width of a text box, the ________ attribute is used.
A. width
B. size
C. length
D. columns
NINE| REVIEW QUESTIONS
Page | 97
WEB TECHNOLOGY 511
TEN|FRAMES
LEARNING OUTCOMES
INTRODUCTION
Users can lose interest in browsing a site that has navigational problems. Frames can
make it easier to navigate a site. A frame is used to display more than one page in the
same browser window, making it easier for users to access information. A frame
within a frame is a nested frame. You can use nested frames to set the layout of a
page.
10.1 UNDERSTANDING FRAMES
You can divide a page into two or more parts by using frames. You use the FRAMESET
tag with the FRAME tag to create a page with frames. The FRAMESET tag specifies the
number of frames on a page. This tag is a container and encloses the FRAME tags.
The following table explains the attributes of the FRAMESET tag.
Attribute Description
COLS Creates vertical frames on a page. The values assigned to this
attribute allow you to specify the width of each frame based
on the browser window. For instance, to create two frames,
one occupying 35% of the width of the browser window and
the other frame occupying the remaining 65%, you would use
the following code:
<FRAMESET COLS=”35%,65%”>
ROWS Creates horizontal frames on a page. The values assigned to
this attribute allow you to specify the height of each frame
based on the browser window.
In the HTML document of a frames page, the FRAMESET tag replaces the BODY tag
TEN| FRAMES
because this page contains only the structure of the frames in the page and not any
content. You define each frame in a frames page by using the FRAME tag. The SRC
attribute of the FRAME tag specifies the page that appears in a frame.
For instance, you can create frames that divide the browser window into two parts:
a list of products on the left and the description of a particular product on the right
(see Exhibit 0-20). This way the user can see the product list and the description of a
product at the same time.
Page | 98
WEB TECHNOLOGY 511
If you want to display a message to users who view the frames page in non-frame supporting browsers,
you use the NOFRAMES tag. To display the message on the page, you use the BODY tag within the
NOFRAMES tag. For instance, to display the message “This page contains frames” in a non-frame
supporting browser, you would use the following code:
<NOFRAMES>
<BODY>
This page contains frames
</BODY>
</NOFRAMES>
Exhibit 0-21: The source code to create frames on the Products page
Page | 99
WEB TECHNOLOGY 511
Creating frames
Here’s how Here’s why
Open the source code To open a blank page. You’ll create frames on this
page.
Open the source code
Observe the code There are no BODY tags because in a frames page
document the FRAMSET tag replaces the BODY
tag.
Place the insertion point as
shown
Enter the code shown in To create frames on the page. The COLS attribute
Exhibit 0-21 of the FRAMESET tag indicates that the page will
have two frames occupying 25% and 75% of the
width of the browser window respectively. The
SRC attribute of the first FRAME tag specifies that
the page “Product list.html” will appear in the left
frame. The SRC attribute of the second FRAME tag
specifies that the page “Content.html” will appear
in the right frame.
Update and close the source code
Refresh and observe the The page is divided into two frames. The left
page frame displays the product list and the right frame
displays the Content page.
Page | 100
WEB TECHNOLOGY 511
Page | 101
WEB TECHNOLOGY 511
Page | 102
WEB TECHNOLOGY 511
Page | 103
WEB TECHNOLOGY 511
page
Point to the border between
the frames
<FRAME SRC=”Logo.html”
NORESIZE>
Attribute Description
BORDERCOLOR Specifies the border color of all frames in the frames page.
Page | 105
Page | 106
WEB TECHNOLOGY 511
Exhibit 0-23: The Products page after removing the borders between two
frames
Modifying frames page properties
Here’s how Here’s why
Observe the page The borders of the frames appear gray, which is
the default. You’ll change the color of the
borders to blue.
Open the source code
Edit the first FRAMESET tag To change the border color of all frames enclosed
to read within this FRAMESET tag to blue.
<FRAMESET ROWS”35,65”
BORDERCOLOR=Blue>
Update and close the source code
Refresh the page The borders of all the frames appear blue.
Open the source code You’ll remove the border between the left and
right frames.
Edit the second FRAMESET
tag to read To remove the borders between the frames
enclosed within this FRAMESET tag.
<FRAMESET COLS=”25,75”
FRAMEBORDER=NO>
Page | 107
WEB TECHNOLOGY 511
<FRAMESET
ROWS=”35,50,15”
BORDERCOLOR=Blue>
Place the insertion point as
shown
To prepare to add the frame for the navigation
bar.
Enter the code To add a frame that contains the Navigate page.
This page has hyperlinks to several pages of the
<FRAME site.
SRC="Navigate.html">
Update and close the source code
Refresh and observe the A new frame appears at the bottom of the page.
page This frame contains hyperlinks to other pages in
the site. Notice that the contents of the left frame
are not fully visible.
Open the source code To add scroll bars to the left frame.
Select SCROLLING=NO as
shown
Delete the code
Update and close the source code
Refresh and observe the Scroll bars appear in the left frame.
page
In the navigation bar, click To view the About us page.
Aboutus
TEN| FRAMES
Page | 108
WEB TECHNOLOGY 511
Cols: specifies the size of, and the number of columns in a <frameset>.
Frame: html element that allows author to present documents in multiple views,
which may be independent windows or subwindows.
Navigation bar:a section of a website or online page intended to aid visitors in
travelling through the online document.
Read
PRESCRIBED TEXTBOOK:
INTERNET & WOZLD WIDE WEB How to Program, 5th Edition, by Paul Deiltel,
Harvey Deitel, Abbey Deitel. Page 99
TEN| GLOSSARY OF TERMS
http://www.gcflearnfree.org/internet101/1
Page | 109
WEB TECHNOLOGY 511
Page | 110
WEB TECHNOLOGY 511
1.3 Which input control in a form that allows a user to select only one option?
A. Check box
B. Text box
C. Text area
D. Radio button
1.5 To create a button that will reset a form, the following code can be used:
A. <reset></reset>
TEN| REVIEW QUESTIONS
Page | 111
WEB TECHNOLOGY 511
A. clear
B. refresh
C. reset
D. new
1.9 When the type attribute of an input tag is equal to hidden. What will be
created.
A. An element with a value that will not be used.
B. A field that will not appear on the page but the content will be
C. submitted to the web server
D. An input element with no data
1.10 To specify the width of a text box, the ________ attribute is used.
A. width
B. size
C. length
D. columns
TEN| REVIEW QUESTIONS
Page | 112
WEB TECHNOLOGY 511
Alt text
Text description of a graphic that appears before the graphic is loaded into
the browser. After an image has been downloaded on the browser, the alt
text may briefly appear over the graphic as you rollover the mouse over the
graphic.
Anchor <a>
The anchor tag is used to define a hypertext link.
Angle brackets
less than (<) and greater than (>) symbols used to surround an element to
create a tag.
Attribute
A property of an HTML element used to provide additional instructions to a
given HTML tag. The attribute is specified in the start of HTML tag.
Broken links
Broken links are those links that do not work because the destination has
been deleted or the path has been changed.
Browser
A program used to access and display HTML documents. Common examples:
Internet Explorer, Netscape, and Mozilla Firefox.
CGI (Common Gateway Interface)
A programming standard that defines how programs communicate with each
other and with the web server. Generally, a CGI-complaint program is called
a script.
Clickable map
Another name for an imagemap.
Closing tag
TEN| GLOSSARY OF TERMS
An HTML instruction that tells the browser to turn off a specific feature of an
opening tag.
Comments
Information added to the code for future reference. The information may
include a brief explanation for what a complex code does. Comments are
ignored by the browsers and they are visible in the source code. HTML
comments start with <!-- and end with -->.
Deprecated element
An element that will be obsolete in the future is referred to as deprecated.
The element can be used today, however, it needs to be removed sometime
in the future to avoid a situation where newer browsers would ignore that
element.
Document content
Parts (such as text and graphics) of a web document that you want the user
to see.
Document Type Definition (DTD)
A specification for a mark-up language.
Domain name
Page | 113
WEB TECHNOLOGY 511
Page | 114
WEB TECHNOLOGY 511
heard without the user taking any additional action (such as clicking, and
installing of a plug-in) because the output is directly placed on the webpage.
Inline elements include, for instance, animated graphics, graphics, and sound.
JPEG or JPG (Joint Photographic Experts Group)
A common cross-platform image format that is used on the web.
Line break
Line break simply refers to stop of the current line and continuation to the
next line. In HTML documents, the <br> tag is used to end a line.
Link
A hypertext link used to connect one document with another document or
file.
Mirror site
A mirror site is a copy of a publicly available website.
Nesting/nested tags
Nesting occurs when you place tags within other tags. Anytime you create an
HTML document, you will end-up using nested tags. For example, the <title>,
and <body>, tags are nested inside the root <html> tag. The <body> tag is
likely to also nest inside of itself other tags.
Navigating
The act of observing the content of web for some purpose.
Obsoleted element
An element that won't necessarily work in the future versions of browsers.
Any obsolete element that you may be using in your website should be
removed; otherwise, newer browsers would ignore that element.
Opening tag
An HTML instruction that tells the browser to turn on the feature and apply it
to the document content that follows.
Out-of-line
Out-of-line refers to those elements that require the user to take some
additional action to see or hear the output of the element. The additional
TEN| GLOSSARY OF TERMS
Page | 115
WEB TECHNOLOGY 511
A style sheet includes styling syntax (rules) that dictates how your web page will look. Style sheets
are very useful as they help web developers create uniform (or consistent) presentation of web
pages.
Syntax
Syntax basically refers to the rules a computer language uses to
perform a task. Without syntax, a computer language would not
be functional or useful at all. HTML syntax dictates what and how
a web page will display.
Syntax error
A syntax error basically refers to a situation in which the rules (or
a rule) of the computer language are (is) broken. In HTML,
depending on the syntax error you produce, the web page may
look completely different than what you had intended.
Tags
The HTML code that controls the appearance of an HTML
document's content.
Transitional (used at the top of a web page to specify HTML
version)
A document defined as transitional may include deprecated
elements and all the new HTML elements. However, the document
cannot contain frames.
Uploading
Think of uploading as just opposite of downloading. While
uploading simply means moving/sending files to the server,
downloading means getting/receiving files from the server.
World Wide Web Consortium (W3C)
An organization consisting of representatives from member
companies and responsible for making rules for the World Wide
Web.
Page | 116