BIT1202 Web Design
BIT1202 Web Design
Learning Outcomes:
At the end of this unit the student should be able to:
Describe and explain web design
Demonstrate the ability to design a web
Appreciate the value of web designing in information flow
Content
History of the World Wide Web (WWW); Internet and the WWW; importance of web design;
Web development using HTML, Dreamweaver etc; web services, feeds and blogs; web design
tools; network and web security; Future trends
Assessment
Type Weighting (%)
Examination 70%
Continuous Assessment 30%
Total 100%
Core Texts
1. Moseley R. (2006): Developing Web applications. John Wiley & Sons Ltd,
England.
2. Deitel, H. M., Deitel P.J. & Goldberg A. B. (2004): Internet & World Wide Web:
how to program. Upper Saddle River, N.J: Prentice Hall.
3. Niederst J. (2001): Learning Web Design; Beginners Guide to HTML, Graphics and
Beyond. Prentice Hall, New Delhi. 8173661677.
References
1. Faster, Smarter(2003) Web Page Creations; take Charge of Web Design and
Production, Faster, Smarter, Better UML. Millhollon, Mary.. Prentice Hall, New Delhi
.8120322452
2. Alan Denis(2002).Systems Analysis and Design an Object Oriented Approach with
UML. Denis Alan..Libraries Unlimited. 0471413879
Table of Contents
CHAPTER 1: INTRODUCTION TO THE INTERNET .......................................................................................- 1 -
1.1 What Is The Internet? .....................................................................................................................- 1 -
1.2 Connections. ...................................................................................................................................- 2 -
1.3 History Of The Internet. ..................................................................................................................- 2 -
1.4 Email................................................................................................................................................- 4 -
1.4.1 E-Mailing Tips...........................................................................................................................- 6 -
1.4.2 Sending Attachments...................................................................................................................- 7 -
1.5 Upload/Download Files...................................................................................................................- 7 -
1.6 Access the World Wide Web ..........................................................................................................- 7 -
1.7 Internet Protocols ...........................................................................................................................- 7 -
How Does Tcp/Ip Work For The Internet? ........................................................................................- 7 -
1.8 Routers............................................................................................................................................- 8 -
1.9 Internet Service Providers (ISP) ......................................................................................................- 8 -
1.10 Internet Ethics...............................................................................................................................- 9 -
1.11 Internet Names And Addresses ....................................................................................................- 9 -
1.12 Domain Name System...................................................................................................................- 9 -
CHAPTER 2: THE WEB..............................................................................................................................- 11 -
2.1 Chapter Overview .........................................................................................................................- 11 -
2.2 Introduction To The Web..............................................................................................................- 11 -
2.2.1 Why is it called the World Wide Web? ......................................................................................- 11 -
2.2.2 What can I find on the Web? .....................................................................................................- 11 -
2.3 The History Of The Internet And The Web ...................................................................................- 13 -
2.3.1 Where does the Web fit into the story? ................................................................................- 13 -
2.3.2 What practical use is the Web to me? ...................................................................................- 14 -
2.3.3 What's the relationship between the WWW and the Internet? ...........................................- 15 -
2.3.4 Features of WWW..................................................................................................................- 15 -
2.4 Internet/Web Terminologies ........................................................................................................- 15 -
2.5 Web Site planning guiding principles............................................................................................- 16 -
2.5.1 Factors to be considered while planning for a website .........................................................- 16 -
2.6 Types Of Web Documents ............................................................................................................- 18 -
2.6.1 Static document .....................................................................................................................- 18 -
2.6.2 Dynamic documents ..............................................................................................................- 19 -
2.6.3 Active documents ..................................................................................................................- 19 -
2.7 Web design tools...........................................................................................................................- 19 -
CHAPTER 3: CREATING YOUR FIRST WEB PAGE......................................................................................- 20 -
3.1 Chapter Overview .........................................................................................................................- 20 -
3.2 What Is Html? ...............................................................................................................................- 20 -
3.3 How HTML Works .........................................................................................................................- 20 -
3.4 HTML: Then and Now...................................................................................................................- 20 -
3.5 HTML and the World Wide Web Consortium ...............................................................................- 21 -
3.6 The Limitations of HTML ...............................................................................................................- 21 -
3.7 The Need for Style Sheets.............................................................................................................- 21 -
3.8 How Web Browsers Affect Your Work..........................................................................................- 22 -
3.8.1 Browser Compatibility Issues.................................................................................................- 22 -
3.8.2 Creating Cross-Browser Compatible Pages............................................................................- 22 -
3.8.3 Cutting-Edge Coding...............................................................................................................- 22 -
3.8.4 Coding for Multiple Screen Resolutions.................................................................................- 23 -
3.9 Bandwidth Concerns .....................................................................................................................- 23 -
3.10 Working with the Cache..............................................................................................................- 23 -
3.11 Should You Use an HTML Editor? ...............................................................................................- 23 -
3.12 Creating a New HTML Document ...............................................................................................- 24 -
3.12.1 Saving a HTML Document ....................................................................................................- 24 -
3.12.2 Closing and Opening a HTML Document .............................................................................- 24 -
3.12.3 Loading a HTML Document in a Local Browser....................................................................- 25 -
CHAPTER 4: HTML ELEMENTS, TAGS & ATTRIBUTES ..............................................................................- 26 -
4.1 Chapter overview..........................................................................................................................- 26 -
4.2 HTML - Elements ...........................................................................................................................- 26 -
4.2.1 <head> Element ....................................................................................................................- 27 -
4.2.2 <title> Element.......................................................................................................................- 27 -
4.2.3 Body Element <body> ............................................................................................................- 28 -
4.2.3.1 Body Margins ..............................................................................................................................- 29 -
4.2.3.2 Base Text.....................................................................................................................................- 29 -
4.2.3.3 Base Links....................................................................................................................................- 29 -
4.2.3 Elements Reviewed................................................................................................................- 30 -
4.3 HTML Tags.....................................................................................................................................- 30 -
4.3.1 Logical vs. Physical Tags .........................................................................................................- 30 -
4.3.2 Nested Tags............................................................................................................................- 32 -
4.3.3 Elements Without Closing Tags .............................................................................................- 32 -
4.4 HTML Attributes............................................................................................................................- 33 -
4.4.1 Title Attribute.........................................................................................................................- 33 -
4.4.2 Align Attribute........................................................................................................................- 34 -
Tips ..................................................................................................................................................- 35 -
4.5 Font ...............................................................................................................................................- 35 -
4.5.1 Font Size .................................................................................................................................- 35 -
4.5.2 Font Color...............................................................................................................................- 36 -
4.5.3 Font Face................................................................................................................................- 36 -
4.6 Body Attributes .............................................................................................................................- 37 -
4.6.1 Bgcolor ...................................................................................................................................- 37 -
4.6.2 Background ............................................................................................................................- 37 -
Tips ..................................................................................................................................................- 38 -
CHAPTER 5: TEXT FORMATTING .............................................................................................................- 39 -
5.1 Chapter Overview .........................................................................................................................- 39 -
5.2 Paragraph Text ..............................................................................................................................- 39 -
5.3 HTML Headings .............................................................................................................................- 40 -
5.4 Formatting Text Elements with Tags ............................................................................................- 41 -
5.4.1 Line Breaks .............................................................................................................................- 42 -
Tips ..................................................................................................................................................- 43 -
5.4.2 <p>Paragraph.........................................................................................................................- 43 -
5.4.2.1 Paragraph Alignment ..................................................................................................................- 43 -
5.4.3 <pre> Preformatting ..............................................................................................................- 44 -
5.4.4 Horizontal Rule.......................................................................................................................- 45 -
5.4.5 Comments in HTML................................................................................................................- 45 -
5.4.6 Abbreviating...........................................................................................................................- 46 -
5.4.7 HTML Character Entities ........................................................................................................- 46 -
CHAPTER 6: HYPERLINKS.........................................................................................................................- 47 -
6.1 Chapter Overview .........................................................................................................................- 47 -
6.2 Hypertext Reference (href) ...........................................................................................................- 47 -
6.3 Link Targets ...................................................................................................................................- 48 -
6.4 Email Links.....................................................................................................................................- 49 -
Email Links:..........................................................................................................................................- 49 -
Complete Email:..................................................................................................................................- 49 -
6.5 Default Links; Base ........................................................................................................................- 49 -
6.6 HTML Comments...........................................................................................................................- 50 -
6.6.1 Comment Tags: ......................................................................................................................- 50 -
Tips ..................................................................................................................................................- 51 -
CHAPTER 7: HTML LISTS..........................................................................................................................- 52 -
7.1 Chapter Overview .........................................................................................................................- 52 -
7.2 Introduction ..................................................................................................................................- 52 -
7.3 Unordered Lists.............................................................................................................................- 52 -
7.4 Ordered Lists .................................................................................................................................- 53 -
7.4.1 Ordered List Types: ....................................................................................................................- 53 -
7.4.2 Numbered List Start Attribute ...............................................................................................- 54 -
7.4.2.1 Numbered List Start - 4:..........................................................................................................- 54 -
7.5 Definition Lists...............................................................................................................................- 54 -
7.5.1 Definition List Code:...................................................................................................................- 54 -
Definition List Display: ........................................................................................................................- 54 -
Tips ..................................................................................................................................................- 54 -
CHAPTER 8: HTML IMAGES .....................................................................................................................- 55 -
8.1 Chapter Overview .........................................................................................................................- 55 -
8.2 Introduction to Images .................................................................................................................- 55 -
8.2.1 Background Images................................................................................................................- 55 -
8.2.2 Inline Images ..........................................................................................................................- 57 -
8.2.2.1 Source URLs ................................................................................................................................- 57 -
8.2.2.2 Image Height and Width Attributes............................................................................................- 58 -
8.2.2.3 Alternative Attribute...................................................................................................................- 60 -
8.2.2.4 Horizontally Align Images ...........................................................................................................- 60 -
For example: .......................................................................................................................................- 60 -
8.2.3 Common Image Types............................................................................................................- 60 -
Tips ..................................................................................................................................................- 61 -
8.2.4 Image Links.............................................................................................................................- 61 -
CHAPTER 9: HTML TABLES ......................................................................................................................- 63 -
9.1 Chapter Overview .........................................................................................................................- 63 -
9.2 Introduction ..................................................................................................................................- 63 -
9.3 Table Rows & Table Columns........................................................................................................- 65 -
9.3.1 Spanning Multiple Rows and Cells .........................................................................................- 65 -
9.3.2 Cell Padding and Spacing .......................................................................................................- 66 -
9.4 Using Tables to implement Layout ...............................................................................................- 68 -
9.5 The bgcolor Attribute....................................................................................................................- 68 -
9.5.1 Web Colors.............................................................................................................................- 69 -
9.5.2 Coloring Fonts, Table Rows, & Table Columns.......................................................................- 70 -
Scoreboard:.........................................................................................................................................- 71 -
9.5.3 Color Codes ............................................................................................................................- 71 -
Tips ..................................................................................................................................................- 71 -
CHAPTER 10: HTML FORMS ....................................................................................................................- 72 -
10.1 Chapter Overview .......................................................................................................................- 72 -
10.2 Introduction ................................................................................................................................- 72 -
Tips ..................................................................................................................................................- 73 -
Attribute..................................................................................................................................................- 74 -
What it does… .........................................................................................................................................- 74 -
10.3 Input Element(s)..........................................................................................................................- 74 -
10.3.1 Web Forms: Value Attribute ................................................................................................- 75 -
10.3.2 Name and ID Attributes .......................................................................................................- 75 -
10.4 Text Fields ...................................................................................................................................- 76 -
10.4.1 Text Fields: Size Attribute ....................................................................................................- 76 -
10.4.2 Text Fields: Maxlength Attribute .........................................................................................- 77 -
10.5 Password Fields...........................................................................................................................- 77 -
10.5.1 Password Fields: Attributes .................................................................................................- 78 -
10.6 Reset Buttons..............................................................................................................................- 78 -
10.7 Submit Buttons ...........................................................................................................................- 79 -
10.7.1 Form Submission - Action ....................................................................................................- 79 -
Tips ..................................................................................................................................................- 80 -
10.8 Checkbox Forms..........................................................................................................................- 80 -
10.8.1 Checkboxes Selected............................................................................................................- 81 -
10.9 Radio Buttons..............................................................................................................................- 82 -
10.9.1 Radio Buttons: The Checked Attribute ................................................................................- 83 -
10.10 Select Fields...............................................................................................................................- 84 -
10.10.1 Disabling Selection Fields...................................................................................................- 84 -
10.11 Hidden Field ..............................................................................................................................- 85 -
10.12 Upload Field ..............................................................................................................................- 85 -
10.12.1 Max File Size Field ..............................................................................................................- 86 -
10.13 Text Areas .................................................................................................................................- 86 -
10.13.1 Text area Wrap...................................................................................................................- 87 -
10.13.2 Text Areas: Readonly .........................................................................................................- 88 -
10.13.3 Text Areas: Disabled...........................................................................................................- 89 -
CHAPTER 11: MULTIMEDIA ELEMENTS...................................................................................................- 90 -
11.1 Introduction ................................................................................................................................- 90 -
11.2 Music Files...................................................................................................................................- 90 -
11.2.1 Embed Attributes - Related to Display.................................................................................- 90 -
11.2.2 Embed Attributes - Related to Functionality .......................................................................- 91 -
Tips ..................................................................................................................................................- 91 -
11.3 Video Codes ................................................................................................................................- 91 -
11.3.1 Video Media Types...............................................................................................................- 91 -
11.3.2 YouTube Videos ...................................................................................................................- 92 -
11.3.3 Embed Attributes .................................................................................................................- 92 -
CHAPTER 12: META TAGS AND META DATA...........................................................................................- 94 -
12.1 Chapter Overview .......................................................................................................................- 94 -
12.2 Meta Tag Description..................................................................................................................- 94 -
12.3 Keyword Meta Tags ....................................................................................................................- 94 -
12.4 Refresh and Redirect Meta .........................................................................................................- 95 -
12.5 Revised Meta ..............................................................................................................................- 95 -
Tips ..................................................................................................................................................- 96 -
CHAPTER 13: HTML STYLE ATTRIBUTES ..................................................................................................- 97 -
13.1 Chapter Overview .......................................................................................................................- 97 -
13.2 Introduction ................................................................................................................................- 97 -
13.3 Styling..........................................................................................................................................- 97 -
13.3.1 Div Element(s) ......................................................................................................................- 98 -
13.3.2 Div inside of Div....................................................................................................................- 99 -
13.4 Page Layouts and Templates....................................................................................................- 100 -
13.4.1 Standard Layout .................................................................................................................- 100 -
Tips ................................................................................................................................................- 102 -
CHAPTER 14: HTML FRAMES.................................................................................................................- 103 -
14.1 Chapter Overview .....................................................................................................................- 103 -
14.2 Introduction ..............................................................................................................................- 103 -
14.3 Adding a Banner or Title Frame ................................................................................................- 103 -
14.4 FrameBorder and FrameSpacing ..............................................................................................- 104 -
14.5 Frame Name and Frame Target ................................................................................................- 104 -
14.5 Noresize and Scrolling...............................................................................................................- 105 -
Tips ................................................................................................................................................- 106 -
CHAPTER 15: SCRIPTING LANGUAGES ..................................................................................................- 107 -
15.1 Introduction ..............................................................................................................................- 107 -
15.2 Javascript Code .........................................................................................................................- 107 -
15.3 VBScript.....................................................................................................................................- 108 -
CHAPTER 1: INTRODUCTION TO THE INTERNET
In essence the Internet is a term used to describe connection of thousands of computers, spanning
all over the world. Some people may liken this to a single entity, but this is not true. The Internet
is transitory, ever changing, reshaping and remolding itself. Ordinarily a collection of thousands
of computers world wide might not attract so much attention. However people are using this new
medium in ways that simply was not possible a mere five years ago.
A Router is a special device. Basically routers sit at key points on the Internet and act like traffic
cops at an intersection of hundreds of streets. The Router basically reads the destination address
on the packets being sent by your computer and then forwards the packet to the appropriate
destination. In some cases your data will travel through several routers before reaching its
ultimate destination.
In effect, the link between Computer A and Computer B can take many paths. It can travel
hundreds or even thousands of miles out of the way in order to reach the other computer. All you
need to know is that it will get there.
As the 1980's progressed the face of computing changed significantly, and with it, the Internet.
More and more commercial and personal computers were going on-line, until, they exceeded the
number of the original users.
The 1990's signaled the start of the "connected" era, with the end of the cold war, and
improvements in military communications, the original Military users of the Internet left for
other communications systems. The Internet was left much as it is today, a collection of
internationally based users and computers.
With improvements on the desktop, there arose a need for better graphics on the Internet. The
Internet up to this point, had been largely a text only system.
The graphics capabilities implemented were called HTML, and a means was invented to allow
users to view these HTML files in their graphic format. With the Internet largely in place, all that
was needed was to invent the transmission mechanism. That mechanism was dubbed the World
Wide Web, or Web for short.
Figure 1.4 shows a typical connection scenario, with your personal or work computer connecting
to the Internet via your ISP's server. Your ISP may go through several connections with other
servers before reaching the "main backbone" of the Internet, the exact route is not information
needed by the typical user.
There are two classes of computers on the Internet, HOSTS and CLIENTS. Unless you have a
permanent link to the Internet and your machine is always connected and on-line, then you are
probably a client and not a host. As a client to the Internet, you should have the following
abilities; (If you don't, talk to your Internet Service Provider)
Send Email
Upload/Download Files
Access the World Wide Web
1.4 Email
It is a computer-based storage and forwarding of text based message. The standard e-mail is
based on a TCP/IP service known as SMTP, simple mail transfer protocol. SMTP protocol
specifies addressing conventions, the “@” sign, usernames, and locations. E-mail is so
widespread that staff is sometimes bombarded with messages, including unsolicited e-mails
known as SPAM mails.
Email is really fast - it is sent and retrieved in seconds, minutes at the most. Contrary to popular
belief, it is not instantaneous. Postal mail is often called snail mail in comparison. Sending email
is easy, too. All you need is access to the Internet, an email program, and the email address of
the person with who you wish to communicate. You can send e-mail messages to one person at
a time or to thousands of people all at the same time.
Like any other tool, electronic mail has its strengths and weaknesses. On the surface, it appears
to be just a faster way of delivering letters, or their equivalent. Electronic mail differs from the
other applications we are looking at because it is not an "end-to-end" service: the sending and
receiving machine need not be able to communicate directly with each other to make it work. It
is known as a "store and forward" service. Mail is passed from one machine to another until it
finally arrives at its destination. This is completely analogous to the way the postal service
delivers mail.
The postal service operates a store and forward network. You address a message and put it into a
post box. The message is picked up by a truck and set to another place and stored there. It is
stored and forwarded to another place. This step is repeated until it arrives at the recipient's
mailbox. If the recipient's mailbox happens to be in place where the postal office cannot deliver
directly (e.g., another country), you can still send the message; the postal service will pass the
message to the postal service of that country for delivery.
In order for an email message to be sent, the person's address should be known. An email
address, like a postal mail address, contains all the necessary information needed to deliver a
message to someone. If there will be something wrong with the email address, it will be sent
back to the sender having the MAILER DAEMON in the mail box.
Internet email addresses consist of a local part and a host part. The username refers to the
mailbox, login name, or the userID of the recipients on that computer. The host part of the
address should be recognizable to the user - a series of words separated by dots. The local part
and the host part of an email address are separated by an @ sign.
username@domain_name.top_level_domain.country_top_level_domain
Username / account name / login name - a unique name given to Internet users to identify
the user of the organization name. It may consist of any combination of letters
and numbers as well as symbols.
Not secure or confidential. Systems administrators can read your mails at any point as
your message is sent from one place to another. Although the employees could be really
practicing their business ethics, nothing can stop them from snooping in your mails.
Special formatting may be lost at recipient’s end.
Occasionally unreliable because some problems might occur in the computer unknown to
the sender or recipient.
Presence of junk mails.
Computer virus can be sent through e-mails.
But like dropping a letter in a mailbox, once you’ve clicked the send button, nothing can stop its
delivery to recipient.
Let the reader know what file format you are sending. Even with the same software vendor, files
aren’t always compatible. An earlier version of a program might not read a file created with a
newer version of the same program.
Computer networking protocols are made up of sequences of binary values collected into groups
called PACKETS, small chunks of data in the Internet that are then transmitted over a media like
coax cable, fiber optic cable or phone lines as electrical signals or pulses of light.
ii. FILE TRANSFER PROTOCOL (FTP): The oldest commonly used method of
transferring files on the Internet. It works in two different modes. The first is that
it can be used to transfer files between any two accounts on the Internet (however,
this requires knowing the passwords of both accounts). The other mode is known
as anonymous FTP. An anonymous FTP site enables anyone to connect into the
system and download files.
Publicly accessible FTP servers are called anonymous servers because of the
procedure used to connect to them. Traditionally, the account logged on to a
server was anonymous; currently it is common to use the FTP account. Similarly,
the traditional password was guest, but most current systems request the use of
your e-mail address as the password.
FTP by itself has no facility to let the user know in advance where a particular file
is available. FTP as a facility of sharing documents is somewhat on the decline
because of the newer tools, but it is still the primary way to acquire computer
software over the Internet.
iii. TELNET (REMOTE ACCESS): The Telnet protocol makes it possible for you
to log onto a remote system - after you've logged onto the Internet itself. Telnet is
a way of "moving" from place to place on the Net. The key concept is this: Just
as the FTP command gives you access to and lets you transfer files from only a
portion of a remote computer, the Telnet command gives you access to a remote
system and lets you run a specific program on that system. Also the Telnet allows
you to create e-mail.
1.8 Routers
These are devices that connect network together. It’s a set of computers that connect the different
pieces of the Internet. Sometimes Ethernets, sometimes token rings, and sometimes telephone
lines. They act as postal substation in the Internet and make decisions about how to route data
(packets).
DIAL-UP – connect through modems and the standard telephone line, connections are
metered or may vary.
DEDICATED – connect through a high-speed line from the user LAN to the ISP.
The idea if for people to use the computers' names when accessing resources, and to let the
computers and routers works with the IP addresses.
Since IP addresses, like 192.172.10.254, are not user friendly and could cause typing errors; the
domain name system (DNS) was created so people would not have to remember several
confusing numbers. Domain names enable short, alphabetical names to be assigned to IP
addresses DNS provides a set of procedures that converts or translates domain names into IP
address and vice versa. DNS provides distributed look up.
The name one chooses to identify themselves on the Internet. E.g. www.shawks.com
This is a division within a company. E.g. If the company shawks Ltd had a division of sales, then
they could be assigned a unique domain name like www.sales.shawks.com
This would either be for a company’s subdivision or an individual computer. e.g. Assume the
sales department in Shawks Ltd had two sub-divisions, products and services. Then the domain
names for the two sub-divisions would be: www.services.sales.shawks.com and
www.products.sales.shawks.com .
CHAPTER 2: THE WEB
Many different types of information are available on the Web. In addition to plain text, Web
pages can also contain pictures, video clips and sounds, and they can even be programmed to
"interact" with the person viewing them. This ability to provide multi-media information content
means that the Web is now an extremely powerful educational tool. The ability to use the Web is
rapidly becoming a fundamental academic skill.
Nobody "owns" the Web, and no central authority is responsible for organizing or regulating the
availability of information on it. This is both a major strength (because it allows uncensored
freedom of information) and a disadvantage (since it can be hard to locate the information that
you require). Despite this de-regulated structure, you should remember that the actual content of
any information provided on the Web is, in most cases, the intellectual property of whoever
originally created it, and is therefore subject to copyright law in the same way as any other form
of publication.
Keep in mind that, while these are the 6 different types of social
media, there can be overlap among the various services. For
instance, Facebook has microblogging features with their “status
update”. Also, Flickr and YouTube have comment systems similar
to that of blogs.
It may help to imagine the Web as a huge de-centralised library. If you need information
about, for example, cinema in France, forest destruction in South America, or job
vacancies in Ireland, then all of that information is probably available somewhere on the
Web.
The Internet is actually more of a historical accident than an invention. The original concept was
developed during the Cold War, as a way of defending America's communication channels
against nuclear attack. The RAND Corporation, a U.S. think-tank, was given the task of devising
a communications system that could still function, even if a substantial portion of it were to be
destroyed.
Such a structure obviously had to be de-centralised, since a large central control site would be
too obvious a target. For this reason, it was decided to use a network of interlinked computers,
each of which had equal authority to send, pass and receive messages. The messages themselves
would be split up into "packets" (small units of data) each of which would be "addressed" to the
recipient computer. But the exact route that each packet took through the network would be
unimportant. If part of the network were destroyed, the packets would simply take another route
to their destination, using the remaining network links.
An early network of four computers, operating on these principles, was established in 1969, and
was called ARPANET. By 1972, this had grown to 37 computers, as scientists and researchers
began to appreciate the advantages of rapid communication. Through the '70s, additional
networks were developed, linked to one another by computers called "gateways". Newsgroups
and mailing lists were set up to facilitate communications between users. The introduction of the
Joint Academic Network (JANET) in the UK in 1984, and the National Science Foundation
Network (NSFNET) in 1986 laid the foundations of what we now know as the Internet - a loose
coalition of networks, all linked together by means of gateways, supporting millions of users
world-wide.
At first, the Web was used only as an experimental tool for exchanging text-based information.
However, the development of more advanced, graphical Web-viewing programs (also called
"browsers") such as Mosaic and Netscape, in 1993-94 enabled people to publish and view Web
documents which contained pictures. More recently, these capabilities have been extended to
include sound and video content. These recent developments have led to a dramatic increase in
the popularity of the Web, which is today the most high-profile application of Internet
technology.
There is no doubt that Web is already changing the ways in which people present information to
one another. Increasingly, educators are realising the potential of this new technology for
developing learning resources that are both more interactive and contain more multimedia
content than traditional lecture and text-book approaches. By combining video and sound clips
with static pictures and text, it is possible to make information both clearer and more interesting
to use. By incorporating form-based "multiple choice"-type quizzes into Web pages, it is
possible to test whether the user has understood the material fully.
In addition, the use of hypertext on the Web means that documents can be logically linked to
one another. Information can therefore be presented in a non-linear format, and material can be
linked to other related resources elsewhere on the Internet. The accessibility of the Web
increases the potential for "distance-learning" and "asynchronous learning", i.e. freeing the
students to choose their own times and places for study, and to progress through the material at
their own rate.
2.3.3 What's the relationship between the WWW and the Internet?
The World Wide Web is just one of the many services that the Internet provides. Some other
services provided by the Internet are email, FTP, gopher, telnet and usenet.
Almost every protocol type available on the Internet is accessible on the web including the
following components: Email, FTP, Telnet, User news, HTTP
(3) E-mail
This is online communication between computer users. It is quick, convenient, efficient and
cheap way to communicate with both individuals and groups.
(4) TELNET
It’s a service that enables remote log in. Users are permitted to log in onto a host and perform
tasks as if they are working on the remote computer itself.
(5) USENET/newsgroups, mailing lists
A huge network of discussion groups
(6) IRC
This is an Internet service that allows a number of users to connect to the same network
node and communicate in real time.
message and information. When planning for this, define the target audience and critical
information about them.
b. Purpose Statement
This should be clear in regard to the following elements;
Level of detail: How much information do we gather and maintain for dissemination on
the web?
Users expected benefit or response: What will the users of the website gain from it?
c. Domain Information
Define what information is necessary for the developers to know and what information will be
provided to users. E.g Are there specialized databases to which developers or users must gain
access? Is there an existing store of online material that will serve as a basis for user information
Plan for the acquisition of domain information. e.g. how will the information be obtained?
d. Web Specification
This document acts as a guidebook for the designers and implementers. The main objective is to
note that the developers have tools, training and time necessary to develop the site according to
the specifications
Note:
The web plan should flow out of and be integrated with the strategic plan of an organization.
e. Web Hosting
A web host stores web site and transmits it to the internet for public view. To put a web site on
the internet you need three things: a domain name, a web site and a web host account. How it
works is that your domain name points to your web host's server which is where your site is
physically housed. Pages are uploaded to web server using FTP Hosting your web site on your
own server is always an option. Here are some
problems to consider:
i. Hardware Expenses
To run a "real" web site, you will have to buy some powerful server hardware. Don't
expect that a low cost PC will do the job. You will also need a permanent (24 hours a day
) high speed connection to your office, and such connections are expensive.
I) Connection Speed
Most providers have very fast connections to the Internet.
24-hour support
Make sure your Internet service provider offers 24-hours support. Don't put yourself in a
situation where you cannot fix critical problems without having to wait until the next
working day. Toll-free phone could be vital if you don't want to pay for long distance
calls.
Daily Backup
Make sure your service provider runs a secure daily backup routine; otherwise you may
lose some valuable data.
Traffic Volume
Study the provider's traffic volume restrictions. Make sure that you don't have to pay a
fortune for unexpected high traffic if your web site becomes popular.
Email Capabilities
Make sure your provider fully supports the email capabilities you need.
Database Access
Make sure your provider fully supports the database access you need if you plan to use
databases from your site.
Advantages:
They are simple, reliable, fast and the documents can be cached locally at a client.
Disadvantages:
Inflexible as content can only be changed by updating the file and Information can become
boring easily.
2.6.2 Dynamic documents
The documents are created by a program like CGI -script.
Advantages
Information is timely and always reflects the latest information.
Disadvantages
They are not reliable.
Slow to access
Advantages
Disadvantages
High cost of execution and maintenance. It is complex and poses great security risks from
servers and codes.
Some WYSIWYG editors can also be used e.g. Front page, Outlook Express, Claris Home page,
Adobe PageMill. One can also use graphic tools like Photoshop, Paint, Animated GIF
construction set, PageMaker etc.
Self Evaluation
1. Define:
a. Web hosting
b. Web server
2. Discuss guiding principles during web development
3. What are the factors to consider in leasing a web server space
CHAPTER 3: CREATING YOUR FIRST WEB PAGE
The Internet is a worldwide network of servers. Your request bounces from server to server until
the URL address of the HTML file you want is found. The data is then returned over the Internet
to your system.
The WEB server holds the HTML file that you are looking for.
When Berners-Lee created HTML, he adopted only the elements of SGML necessary for
representing basic office documents such as memos and reports. The need for new markup
languages and standards to address these demands is handled by the World Wide Web
Consortium (W3C).
HTML adopts many features of SGML, including the cross-platform compatibility that allows
different computers to download and read the same file from the Web. 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. Because HTML was not designed as a layout
language, many editing programs create less-than-standard code to accomplish a certain effect.
You cannot rely on the HTML editor’s WYSIWYG view to test your Web pages. Despite its
limitations, HTML is ideal for the Web because it is an open, non-proprietary, cross-platform
compatible language.
Browser-Specific Coding
Some Web sites are coded for one particular browser or brand of browsers only. The author may
have wanted to use a unique enhancement for the site, or may have found that the site did not
render properly in other browsers. On the Web, you never can be sure of the type of browser
your user has. However, this method of browser-specific coding may be viable on a company
intranet, where you know or you can specify that all users have the same brand and version of
browser.
A computer monitor’s screen resolution is the width and height of the computer screen in
pixels. Most monitors can be set to at least two resolutions, whereas larger monitors have a
broader range from which to choose. Screen resolution is a function of the monitor’s capabilities
and the computer’s video card. The three most common screen resolutions (traditionally
expressed as width X height in pixels) are 640 X 480, 800 X 600, and 1024 X 768.
Connection speed is another factor that should influence your Web page design. Most users
simply will not wait longer then 10-20 seconds for a page to load. If your pages download
slowly, your users probably click to go to another site before they see even a portion of your
content. Because the single biggest factor influencing the speed at which your pages render is
the size and number of graphics on your Web pages, you should keep your page designs simple
with few graphics.
Many of the latest office applications now convert documents to HTML. As with the browsers,
authoring packages interpret tags based on their own built-in logic.Therefore, a page that you
create in an editing package may look quite different in the editing interface than it does in a
browser.
ASSIGNMENT
Discussion Questions
Projects to Assign
Examine the HTML source code for some professionally designed web pages, and compare that
with what you created in the chapter exercises. Chart some differences or similarities.
CHAPTER 4: HTML ELEMENTS, TAGS & ATTRIBUTES
A single page can contain hundreds or thousands of elements, but when all is said and done,
every HTML page should have a bare minimum of four critical elements: the HTML, head, title,
and body elements.
<html> Element...</html>
<html> is the element that begins and ends each and every web page. Its sole purpose is to hold
each web element nicely in position and serves the role of book cover; all other HTML elements
are encapsulated within the <html> element. The tag also lets web browsers know, "Hey, I'm an
HTML web page!", so that the browser knows how to render it. Remember to close your HTML
documents with the corresponding </html> tag to signify the end of the HTML document.
If you haven't already, it is time to open up Notepad or Notepad++ and have a new, blank
document ready to go. Copy the following HTML code into your text editor.
If you opened up your index.html document, you should be staring at your very first blank
(white) web page!
The <head> is usually the first element contained inside the <html> element. While it is also an
element container that encapsulates other HTML elements, these elements are not directly
displayed by a web browser. Instead they function behind the scenes, providing more descriptive
information about the HTML document, like its page title and other meta data. Other elements
used for scripting (JavaScript) and formatting (CSS) are also contained within the <head>
element, and we will eventually introduce how to utilize those languages. For now, the head
element will continue to lay empty except for the title element, which will be introduced next.
If you've made the code changes and refreshed the browser page, you will notice that we still
have nothing happening on the page. So far, all we've done is add a couple of necessary elements
that describe the web page document to the web browser. Content -- the stuff you can see -- will
come next!
Name your webpage as you please. Just keep in mind that the best titles are brief and descriptive.
Title
HTML - <body> Element
The element that encapsulates all the visual elements (paragraphs, pictures, tables, etc.) of a web
page is the <body> element. The <body> tag serves as the element containing all the content for
the website. Tables, lists, forms, paragraphs, and everything else must be placed within the body
element to ensure each element is displayed on your site.
Unique Attributes
A unique set of margin attributes are available to the body tag. These attributes work much like
those of a word processing program, allowing you set pixel value margins for the left, right, top,
or bottom of your website. Setting these attributes means that all the content you place within
your body tags will honor the preset margin.
HTML Code:
<body topmargin="50">
<body leftmargin="50">
The text attribute sets the text color of all text contained within the body tags. Think of it as a
means to set the color of your text, unless otherwise noted. Basically, you use these tags to set a
base color scheme, which you can later modify through additional tags inside of the body.
HTML Code:
<body text="red" >
or
Along the same lines, we may also specify base colors for visited or unvisited links. This method
has deprecated, and we recommend that you use Cascading Style Sheets (CSS) instead.
HTML Code:
<body link="white" vlink="black" >
or
Setting a baselink is a great way to ensure your viewers will not receive the annoying error
message that occurs with broken links.
4.2.3 Elements Reviewed
To recap quickly: we've laid out a set of four essential elements that are used to create a strong
foundation and structure for your web page. The <html> element encapsulates all page content
and elements, including two special elements: the <head> and <body> elements. The <head>
element is a smaller container for elements that work behind the scenes of web pages, while the
<body> element houses content elements such as web forms, text, images, and web video.
From here on out, the examples we provide will assume that you have a firm understanding of
these key elements and know to place the majority of your HTML code inside of the <body>
element.
A web browser reads an HTML document from top to bottom, left to right. Each time the
browser finds a tag, the tag is rendered accordingly. Paragraph tags render paragraph text, image
tags render images, etc. By adding tags to an HTML document, you are not only coding HTML,
but also signaling to the browser, "Hey look, this is paragraph text; now treat it as such!"
Do you recall that HTML elements are comprised of three major parts: the opening tag, the
content, and the closing tag? As you will learn, there are infinite combinations of HTML
tags/elements, including those used for forms, images, and lists. Everything displayed on an web
page requires the use of a tag or two.
Tags should always be written in lowercase letters if you plan on publishing the page online, as
this is the web standard for XHTML and Dynamic HTML.
Logical (Idiomatic Elements) tags are designed to describe (to the browser) the enclosed text's
meaning. A logical character tag describes how the text is being used, not necessarily how it is
formatted. An example of a logical tag is the <strong> </strong> tag. By placing text in between
these tags you are telling the browser that the text has some greater importance. By default all
browsers make the text appear bold when in between the <strong> and </strong> tags.
The original intent of HTML was to mark up text to indicate the purpose of each part of the
document. Text within the <H1 ...> is a header, text within <CODE> is code from a program.
Although logical tags indicate different types of information, most of them are usually rendered
in one of just a few ways: italics, bold, or monospace (all characters the same width):
So if logical tags just look like bold or italics, why use them at all? Why not just use <B> when
you want bold? Logical tags have lost favor to "formatting" tags, which indicate the physical
appearance of the document (for example <B> for BOLD). This loss of popularity is unfortunate,
because logical tags still serve some important purposes:
Logical tags allow the browser to render that information in the manner most appropriate
for that browser. Text that should be emphasized (<EM>) may be best emphasized in
Windows with italics, and bold in Unix.
Logical tags help you, the author, keep track of what you are saying, without the
distraction of presentation. If you need to indicate someone's address, use <ADDRESS>,
knowing it will be presented in an appropriate manner.
Physical tags on the other hand provide specific instructions on how to display the text they
enclose. They controls how the characters are formatted.
Examples of physical tags include:
Physical tags were invented to add style to HTML pages because style sheets were not around,
though the original intention of HTML was to not have physical tags. Rather than use physical
tags to style your HTML pages, you should use style sheets.
There are a few elements that do not require formal closing tags. In a way, they still have the 3
parts (opening/closing and content), but they are consolidated into one tag. The reason for this is
that these tags do not really require any content to be placed within them, but sometimes may
require attributes such as source URLs for images.
One prime, easy example of an HTML tag that does not require a closing tag is the line break
tag.
HTML Code:
<img src="../mypic.jpg" /> -- Image Tag
<br /> -- Line Break Tag
<input type="text" size="12" /> -- Input Field
As you can see from the above, the web browser is capable of interpreting the image tag as long
as we inform the browser where the image file is located, using the src attribute. Some HTML
elements have combined closing tags.
<body bgcolor="blue">
This tag defines an HTML table: <table>. With an added border attribute, you can tell the
browser that the table should have no borders:
<table border="0">
Attributes always come in name/value pairs like this: name="value". Attributes are always
added to the start tag of an HTML element and the value is surrounded by quotes. In short,
attributes are like blue print schematics informing the browser how to render an HTML element.
As an HTML tag is processed, the web browser looks to these attributes as guides for the
construction of web elements. Without any attribute values specified, the browser will render the
element using the default setting(s). Common examples of attributes;
4.4.1 Title Attribute
The title attribute titles an HTML element and adds a tiny text pop-up to any HTML element,
offering your web viewers a tool-tip mechanism where information can be found or where a
better description of an HTML element can be seen.
Much like the tool tips found in word processing programs, this attribute can add spice to any
page while offering the user priceless interactivity. As the mouse hovers over the element, a tool
tip is displayed, giving the viewer just one extra piece of information.
HTML Title Attribute:
<h2 title="Hello There!">Titled Heading Tag</h2>
Hover your mouse over the display heading and watch the title attribute in action!
The title attribute is one that has not deprecated and should be used often. Many search engines
are capable of identifying this attribute inside your HTML elements, granting increased search
rankings based on the relevance of the title attribute text.
If you wish to change the horizontal alignment of your elements, you may do so using the align
attribute. It allows you to align things left, right, or center. By default, most elements are
automatically aligned left, unless otherwise specified.
Tips
4.5 Font
The <font> tag provides no real functionality by itself, but with the help of a few attributes, this
tag is used to change the style, size, and color of HTML text elements. The size, color, and face
attributes can be used all at once or individually, providing users with the ability to create
dynamic font styles for any HTML element.
Note: The <font> and <basefont> tags are deprecated and should not be used for published
work. Instead, use CSS styles to manipulate your font.
Set the size of your font with size. The range of accepted values goes from 1 -- the smallest, to 7
-- the largest. The default size of a font is 3.
Choose a different font face by specifying any font you have installed. Font face is synonymous
with font type. As a web designer, be aware that if you specify a custom font type and users
viewing the page don't have the exact same font installed, they will not be able to see it. Instead
the chosen font will default to Times New Roman. To reduce the risk of running into this
situation, you may provide a list of several fonts with the face attribute, such as outlined below.
In the example above, we have changed the font face (type) of a paragraph element and specified
a list of similar fonts to apply to this element in the case that some of our viewers do not have
these fonts installed.
The <body> tag has two attributes where you can specify backgrounds. The background can be a
color or an image.
4.6.1 Bgcolor
The bgcolor attribute specifies a background-color for an HTML page. The value of this attribute
can be a hexadecimal number, an RGB value, or a color name:
<body bgcolor="#000000">
<body bgcolor="rgb(0,0,0)">
<body bgcolor="black">
The lines above all set the background-color to black.
4.6.2 Background
The background attribute can also specify a background-image for an HTML page. The value of
this attribute is the URL of the image you want to use. If the image is smaller than the browser
window, the image will repeat itself until it fills the entire browser window.
<body background="clouds.gif">
<body background="http://profdevtrain.austincc.edu/html/graphics/clouds.gif">
The URL can be relative (as in the first line above) or absolute (as in the second line above).
If you want to use a background image, you should keep the following in mind:
Will the background image increase the loading time too much?
Will the background image look good with other images on the page?
Will the background image look good with the text colors on the page?
Will the background image look good when it is repeated on the page?
Will the background image take away the focus from the text?
Note: The bgcolor, background, and the text attributes in the <body> tag are deprecated in
the latest versions of HTML (HTML 4 and XHTML). The World Wide Web Consortium (W3C)
has removed these attributes from its recommendations. Style sheets (CSS) should be used
instead (to define the layout and display properties of HTML elements).
Don't use font tags if at all possible! Use CSS Styles instead!
Fonts add character and originality to sites, so long as they're not overused or unreadable.
Use consistent fonts throughout your site.
Nobody enjoys websites that are hard to read, so keep your fonts legible!
Use formatting tags rather than the font tag for bold or italic texts.
Assignment
Think of a topic for your own web page. Now create your own HTML text file that
includes a <title> tag and a few introductory sentences. Save the HTML file and reload it
in your web browser. Keep this file handy as you will add to it in later lessons.
CHAPTER 5: TEXT FORMATTING
Text is the backbone of any web page. It plays an double role; it provides content for web surfers
to enjoy as they skim through articles and articles of information, but it also gives Search
Engines and Spiders keywords and meta data. It is because of text on web pages that we have a
network of seemingly endless information available at our fingers.
Any text containing more than a few lines (or sometimes even more) should exist inside of a
paragraph tag <p>. This tag is reserved specifically for blocks of text, such as those you would
expect to find inside your favorite novel.
Precision is important when writing your code. Web spiders are a little forgiving when it comes
to malformed HTML elements. For best results, do your best to ensure your code is complete and
accurately constructed.
HTML has heading tags which can be used as headers or subheaders. By placing text inside of an
<h1> heading tag, for example, the text displays bold and the size of the text increases to a 24pt
font size. Heading tags are numbered 1 through 6, and they change size depending on which tag
you choose, with 1 being the largest font size at 24pt, and 6 being the smallest font size at 8pt.
Place these lines into your HTML file and you should see results similar to what you see below.
Notice that each heading has a line break (a blank line) rendered before and after it. This is a
built-in attribute associated with the heading tag. Each time you place a heading tag, your web
browser automatically places a line break in front of your beginning tag and after your ending
tag, just like it does with <p> tags. This is expected behavior, and as a designer you need to take
these line breaks into consideration when designing a layout.
As you begin to place more and more text elements onto your website, you may find yourself
wanting to incorporate bold or italic properties in your text elements. HTML offers a handful of
special tags that can be utilized to do just that. Formatting elements such as <b> should be used
sparingly, and what we mean by that is that you should only use them to bold or italicize one or
two words at a time. If you wish to bold an entire paragraph, the better solution would involve
Cascading Style Sheets (CSS) and adjust the element's font-weight property. Try out the code
given below and take note of the effect it creates on your web document. The expected outcome
is provided to guide you;;
All of these tags add a pinch of flavor to HTML text elements, from paragraphs to lists and text
links
5.4.1 Line Breaks
A line break is used in HTML text elements, and it is the equivalent of pressing Enter or Return
on your keyboard. In short, a line break ends the line you are currently on and resumes on the
next line. Earlier, we mentioned that each paragraph element begins and ends with a line break,
which creates an empty space between the start of a paragraph element and the end of a
paragraph element.
As we've mentioned, line break elements are a little different from most of the tags we have seen
so far because they do not require a closing tag. Instead, their opening and closing tags are
combined into a single line break element. Placing <br /> within the code is the same as pressing
the return key in a word processor. Use the <br /> tag within other elements such as paragraphs
(<p>).
Address:
Allan Muthomi
Box 9688
G.P.O, Nairobi
We have created an address for a letterhead and used a line break <br /> tag inside of a paragraph
element to add some line breaks to make this text appear more like an address. Here's another
look as we add a signature element to the same letter.
<p>Sincerely,<br />
<br />
<br />
Trizah Nimos<br />
Vice President</p>
Closing Letter:
Sincerely,
Trizah Nimos
Vice President
Tips
Remember that there is a special tag for line breaks and horizontal rule tags.
Use this page as a reference if you ever need to format your website's text in the future.
5.4.2 <p>Paragraph
Paragraph Justification
Paragraphs can be formatted in HTML much the same as you would expect to find in a word
processing program. Here the align attribute is used to "justify" our paragraph.
HTML Code:
<p align="justify">For instance, let's say you had a HUGE school or work...</p>
For instance, let's say you had a HUGE school or work project to complete. Off hand, the easiest
way to transfer the documents from your house could be a 3.5" floppy disk. However, there is an
alternative. Place your documents, photos, essays, or videos onto your web server and access
them from anywhere in the world.
Paragraph Centering
HTML Code:
<p align="center">For instance, let's say you had a HUGE school or work...</p>
For instance, let's say you had a HUGE school or work project to complete. Off hand, the easiest
way to transfer the documents from your house could be a 3.5" floppy disk. However, there is an
alternative. Place your documents, photos, essays, or videos onto your web server and access
them from anywhere in the world.
Each line of the paragraph has now been centered inside the display window.
For instance, let's say you had a HUGE school or work project to complete. Off hand, the easiest
way to transfer the documents from your house could be a 3.5" floppy disk. However, there is an
alternative. Place your documents, photos, essays, or videos onto your web server and access
them from anywhere in the world.
Every line of the paragraph above is now aligned to the right hand side of the display box.
A web browser interprets your HTML document as being one long line. Sure, you may have tabs
and line breaks in Notepad which align your content so it's easier for you to read, but your
browser ignores those tabs and line breaks.
We showed you that you can get around this problem by using the <br/> tag, but tabs and
spacing are quite different from one another and can be absolutely annoying at times. One
simpler solution might be to use the <pre> tag, which stands for previously formatted text.
Use the <pre> tag for any special circumstances where you wish to have the text appear exactly
as it is typed. Spaces, tabs, and line breaks that exist in your actual code will be preserved with
the <pre> tag.
The horizontal rule does not have a closing tag. It takes attributes such as align and width. For
instance:
<p> This html comment would <!-- This This HTML comment would be displayed like
is a comment --> be displayed like this. </p> this.
Notice you don't see the text between the tags <!-- and -->. If you look at the source code, you
would see the comment. To view the source code for this page, in your browser window, select
View and then select Source.
Note: You need an exclamation point after the opening bracket <!-- but not before the closing
bracket -->.
HTML automatically adds an extra blank line before and after some elements, like before and
after a paragraph, and before and after a heading. If you want to insert blank lines into your
document, use the <br> tag.
5.4.6 Abbreviating
The code <abbr title="World Wide Web">WWW</abbr> would display WWW but when you
hold your mouse pointer over the WWW, the text world wide web (in the title attribute) will
appear in.
The World Wide Web got its spidery name from the plentiful connections (links) that link
websites together with the click of a button. What most people don't know is that HTML links
are actually HTML anchors constructed using anchor tags (<a>).
While the example above appears and feels like a text link when viewed through a web browser,
the element is incomplete as it is missing a vital attribute that references another web page called
a Hypertext Reference (href).
To create a hyperlink, you use the tag in conjunction with the href attribute (href stands for
Hypertext Reference). The value of the href attribute is the URL, or, location of where the link is
pointing to.
A Hypertext Reference (href) is an HTML attribute of an anchor (link) tag that requires a valid
URL in order to properly direct a user to a different location. In other words, this Hypertext
Reference is where users will navigate to if they do click on this link. Use the demonstration
below as a reference.
The address of a website is called a Uniform Resource Locator (a URL), and it acts like a street
address for a website as a user is directed from one site to another. There are different types of
URLs, and each has a slightly different look depending on the hyperlink reference. Here's a look
at the different types of URLs.
The name attribute is used to create a named anchor. When using named anchors we can create
links that can jump directly to a specific section on a page, instead of letting the user scroll
around to find what he/she is looking for. Unlike an anchor that uses href, a named anchor
doesn't change the appearance of the text (unless you set styles for that anchor) or indicate in any
way that there is anything special about the text. Below is the syntax of a named anchor:
<a name="top">Text to be displayed</a>
To link directly to the top section, add a # sign and the name of the anchor to the end of a URL,
like this:
This Code Would Display
href="http://virtualcampus.mtkenyaUniversity.com/html Back to top of page
/10links.html#top">Back to top of page </a>
The target attribute defines how each link will open when clicked. Will each one open in a new
window, or will each one open in the current browser window? As the web designer, you call the
shots as to how a user navigates from page to page, so long as you know how to handle the
target attribute.
Link Targets:
Target Description
_blank Opens new page in a new browser window
_top Loads new page into the current browser window, cancelling all frames
The two most important values are the top two, (target="_blank" and target="_self"). The _self
value is generally the default. It loads each new page in the current browser window, while
_blank opens up a new web browser window with each click of the text link.
The code below shows how you would link to facebook.com, a popular sports website. The
target attribute is added to allow the browser to open facebook in a new window, so that the
viewer can have a window that remains opened to our website. Try the example below and note
the outcome;
Links are a big part of the user experience for any website. Always try to keep that in mind when
working on a site's navigation. A web page that opens a new web browser window each time a
user clicks a link is not the greatest way to entice users to stick around.
Creating an email link is simple. If you want people to mail you about your site, a good way to
do it is place an email link with a subject line already filled out for them.
Email Links:
[email protected]
In some circumstances, it may be necessary to fill in the body of the email for the user as well.
Complete Email:
[email protected]
Use the <base> tag in the head element to set a default URL for all links on a page to go to. It's
always a good idea to set a base tag just in case your links become bugged somewhere down the
line. Usually, you should set your base to your home page.
Comments are a great asset to new developers and a great way to place little notes for reminding
yourself what various pieces of code are doing. Comments are also great ways to troubleshoot
bugs and code errors, as they give you the ability to comment out lines of code one at a time to
search for the exact line causing problems.
As a sprouting young web developer, HTML code comments are your friends! A comment is a
way to control which lines of code are to be ignored by the web browser and which lines of code
to incorporate into your web page. There are three main reasons why you may want your code to
be commented out or ignored.
Comment out elements temporarily rather than removing them, especially if they've been
left unfinished.
Write notes or reminders to yourself inside your actual HTML documents.
Create notes for other scripting languages like JavaScript which requires them.
As you can see, comments are also comprised of an opening and closing tag, (<!-- -->). Like
other HTML elements, these tags can span across multiple lines of code, allowing you to
comment out large blocks of HTML code. Any HTML elements that are encapsulated inside of
the comment tags will be ignored by the web browser. This makes comment tags quite useful for
debugging, as they allow the developer to temporarily comment out pieces of an HTML
document without having to immediately delete the code from the HTML document.
Placing notes and reminders to yourself is a great way to remember your thoughts and to keep
track of elements embedded inside the web page. Also, your code may exist for many, many
years, and these notes to yourself are a great way to remember what was going on, since you may
not remember five or more years down the road.
All combinations of text placed within the comment tags will be ignored by the web browser.
This includes any HTML tags, scripting language(s), etc.
As a web designer, you may sometimes have different websites in progress at once, and it might
be easy to leave some HTML elements unfinished. In this case, you may comment out an
element until it is 100% ready for the site. Below, we have commented out an input form
element, since we are not quite ready to receive input from our users.
HTML Code:
<!-- <input type="text" size="12" /> -- Input Field -->
Now when we are ready to show that element, we can simply remove the comment tags, and our
browser will readily display the element! Comment out elements and bits of code that you may
want to recall and use at a later date. Nothing is more frustrating than deleting bits of code only
to turn around moments later and realize that you now need to recode them.
Tips
Frequent use of comments allows you to recall your train of thought the next time you
take a look at the HTML code.
Commenting out elements or code chunks helps debug without having to delete and then
retype code.
CHAPTER 7: HTML LISTS
7.2 Introduction
HTML provides a simple way to show listed items. There are actually three different types of
HTML lists, including unordered lists (bullets), ordered lists (numbers), and definition lists
(think: dictionaries). Each list type utilizes its own unique list tag where the actual list tags
themselves e.g. <ul> are nothing but container elements for list items (<li>). They work behind
the scenes to identify the beginning and ending of an HTML list element.
To render a list with a different bullet type, add a type attribute to the unordered list element.
Using the same code in the example above, replace the <ul> line from the previous example with
any of the lines listed below to change the bullet from disc shape to another shape.
HTML Unordered List Type Code:
<ul type="square">
<ul type="disc">
<ul type="circle">
HTML Unordered List Types:
type="square" type="disc" type="circle"
The numbering of an HTML list can be changed to letters or Roman Numerals by once again
adjusting the type attribute.
HTML Code:
<ol type="a">
<ol type="A">
<ol type="i">
<ol type="I">
7.4.1 Ordered List Types:
Lower-Case Letters Upper-Case Letters Lower-Case Numerals Upper-Case Numerals
a. Find a Job A. Find a Job i. Find a Job I. Find a Job
b. Get Money B. Get Money ii. Get Money II. Get Money
c. Move Out C. Move Out iii. Move Out III. Move Out
The start attribute allows you to further customize an HTML ordered list by setting a new
starting digit for the ordered list element.
7.4.2 Numbered List Start Attribute
<h4 align="center">Goals</h4>
<ol start="4" >
<li>Buy Food</li>
<li>Enroll in College</li>
<li>Get a Degree</li>
</ol>
These lists displace the word term (<dt>) in such a way that it rests just above the definition
element (<dd>) to offer a very unique look. For best, results we suggest bolding the definition
terms with the bold tag <b>.
Tips
Use the start and type attributes to customize list elements.
It is possible to make lists of lists, which is helpful for creating some items, such as
outlines.
CHAPTER 8: HTML IMAGES
Images are a staple of any web designer, so it is very important that you understand how to use
them properly. In order to place an image onto a website, one needs to know where the image
file is located within the file tree of the web server -- the URL (Unified Resource Locator).
Images can either be used as background images (behind text) or inline images (together with
text).
<body background=”mtkenya.jpg”>
Take note that for this to work, your source code, webpage (HTML document you have created)
and the picture should be in the same folder. You have to note and use the picture’s file
extension(.jpg, .gif, .png, .bmp e.t.c) in your code.
There are two design issues you need to take note of here.
i. Whilst the background image may be used for aesthetic purposes, it should
not interfere with elements on the foreground. For example, it should not
interfere with legibility of text like it has done in our case. To correct this,
open the original image in a graphics editor and edit it to be a watermark. This
can also be achieved by increasing the brightness.
ii. Unless if necessary, tiled backgrounds like in our case are visually disruptive
and should be avoided. Using a graphics editor to change the size of the
original image appropriately then refreshing the webpage would remedy this.
The illustration below captures the implementation of point (i) and (ii) above. Using Microsoft’s
Picture Manager, the figure was increased to 500% of the original size and the brightness
increased.
8.2.2 Inline Images
These are called to the webpage by the src attribute. Src stands for "source". The source attribute (src) is
what makes an image tag display an image. An image source is a URL value and should point to the
directory location of an image file. For example, the code
An image source value is essentially the URL of a picture file and tells the web browser where
the image is located so that it can then display the image correctly.
Image source URLs can be either local or global, meaning that the picture files you wish to
display on your website can be either hosted locally on your machine (local) or hosted elsewhere
on some other web site domain (global).
Global: http://www.mkuonline.com/pics/graduation.gif
Local: pics/mtkenya.jpg
Local URLs are relative to the file path of the web page itself. For example, if the picture file is
placed inside the same directory as the web page, then the local URL for the image would simply
be the name of the image, since it is residing in the same directory as the HTML page.
Local URLs Explained:
Local Src Location Description
src="../sunset.gif" picture resides one folder "up" from the .html file
picture file resides in the pics directory, one folder "up" from the .html
src="../pics/sunset.gif"
file.
Pictures must reside on the same web host as your .html file in order for you to use local URLs.
A URL cannot contain drive letters such as C:\, since a src URL is a relational interpretation
based on the location of the.html file and the location of the picture file. Something like
src="C:\www\web\pics\" will not work.
Each URL format has its pros and cons. Using the URL of pictures on other sites poses a
problem if the other site happens to change the physical location of the picture file. Copying the
file directly to your web server solves this problem. However, as you continue to upload picture
files to your system, you may eventually run short on hard drive space. Use your best judgment
based upon your situation.
Height and width are HTML attributes that define an element's height and width properties.
These values can either be percentage-based (%) or rely on pixel sizes.
Above, we've used hard-coded pixel values for the height and width of the sunset image to
ensure that this image will always render 50 pixels high by 100 pixels wide. By hard-coding
these values, we are ensuring that the image will only display 50 pixels high by 100 pixels wide,
even if the picture file itself happens to be much larger. If the dimensions of the picture are much
larger, then we risk some severe skewing as the browser tries to shrink our image into our small
box.
Height and width values can also be a percentage. Percentage values are relative to the parent
HTML element (usually the body), which means if you have a parent element like a <body>
element that is the whole screen (1024x768), then an image with a height and width of 100% will
take up that entire body element (1024x768). In our example below, we have placed the image in
a table element that is about 400 pixels wide by 200 pixels tall.
Here's a few things to remember when trying to place images on your web page:
1. Maintain the same height to width ratio. The ratio is critical, and must be maintained
to avoid skewing.
2. Always scale down. -- Larger images will always scale down nicely and continue to look
sharp.
If no height or width attribute is specified inside the <img> tag, the browser will use the actual
dimensions of the image file to render the image. This can cause problems with the page layout if
the picture file is too large, as other HTML elements will be moved further down the page in the
event of an over-sized image.
Another concept to keep in mind is that as a browser begins rendering HTML components, it
handles them one after another in sequence. Before it can move from one element on to the next,
the browser needs to know the size and shape of an element. If this information is provided in the
tag, that's one less step required by the browser to render an image element and will result in the
page loading faster for your users.
The alt attribute specifies alternate text to be displayed if for some reason the browser cannot
find the image, or if a user has image files disabled in their web browser settings. Text-only
browsers greatly depend on the alt attribute since they are not capable of displaying pictures.
The alt attribute is also an attribute that search engines may look for when displaying images.
The text value contained within this attribute must reflect the substance of the image in order to
receive "credit" from a search engine.
Images can be aligned horizontally to the right or to the left of other elements using the align
attribute. Image elements are aligned to the left by default.
1. align
o right
o left
For example:
<img src="mtkenya.jpg" align="right">……… Align to the right
<img src="mtkenya.jpg" align="right">……….Aligns in the middle (center)
<img src="mtkenya.jpg" align="right">……….Aligns to the left
As you can see, the image's right edge has now been aligned with the
right edge of the display box. Since the display box is the parent element,
this is the desired behavior for the align attribute. If we take this example
a step further, you can achieve some really great designs by embedding
aligned images inside of paragraph <p> elements.
Gifs are best used for banners, clip art, and buttons. The main reason for this is that .gif files can
have transparent backgrounds -- a priceless attribute when it comes to web design. On the down
side, .gif files are limited to only 256 colors and any .gif image containing more than a few
colors tends to have a larger file size than their .jpeg or .png counterparts. Large picture files are
a plague of web design!
Jpegs have an unlimited color wheel and a high compression rate, which downsizes your load
times and saves on hard drive space. Although .jpeg (or .jpg) files don't allow for transparent
backgrounds, their size/quality ratio is outstanding. It's best to use .jpeg files for photo galleries
or artwork. Avoid using .jpeg files for graphical designs, though; stick to using them for
thumbnails, backgrounds, and photo galleries.
PNG image files are the best of both worlds. They have a large color wheel, low file size, and
allow for transparencies like .gif images do. With a high-compression rate and transparent
coloring, they might just be the best format for any web graphics.
When in doubt, try saving an image in multiple formats and decide which is better, keeping file
size and quality in mind.
Tips
Image links are constructed as you might expect, by embedding an <img> tag inside of an anchor
element <a>. Like HTML text links, image links require opening and closing anchor tags, but
instead of placing text between these opening and closing tags, the developer needs to place an
image tag -- with a valid source attribute value of course.
By default, many browsers add a small border around image links. This default behavior is
intended to give web viewers the ability to quickly decipher the difference between ordinary
images and image links. Since this default is different from web browser to web browser, it may
be best to squelch this ambiguity and set the border attribute of the image tag to 0 or 1.
Thumbnails are by far the most common type of image link seen in today's world. To create a
thumbnail, one must save a low-quality version of a picture with smaller dimensions. Then, one
should link this low-quality picture to its higher-quality counterpart.
Thumbnails are intended to give your audience quick previews of images without them having to wait
for the larger, higher-quality image to load. Photo galleries make heavy use of thumbnails, and they will
allow you to display multiple pictures on one page with ease.
Thumbnail Code:
<a href="mtkenya.jpg">
<img src="thmb_mtkenya.jpg" />
</a>
HTML Thumbnails:
CHAPTER 9: HTML TABLES
An HTML table is an element comprised of table rows and columns, much like you'd see when
working with an application such as Excel. Tables are container elements, and their sole purpose
is to house other HTML elements and arrange them in a tabular fashion -- row by row, column
by column. By the end of the chapter you should be able to;
9.2 Introduction
Tables may seem difficult at first, but after working through this lesson, you'll see that they aren't
so horrible. A table element consists of three different HTML tags including the <table> tag,
<tr> (table rows), and the <td> (table columns) tags.
We've adjusted the formatting of the code by adding additional spaces before some of the table
elements, but this has no bearing on the rendering of the element. It simply helps keep track of
each tag/element and helps us ensure we don't miss an opening or closing tag which would
prevent our table element from rendering correctly. We've also added a border attribute to ensure
the table cells/rows are more visible to our readers.
Content elements like HTML lists, images, and even other table elements can be placed inside
each table cell. Doing so aligns the elements in a tabular fashion and provides structure.
HTML Table Code:
<table border="1">
<tr>
<td width="50%">
<ul>
<li>List Item 1</li>
<li>List Item 2</li>
<li>List Item 3</li>
</ul>
</td>
<td>
<ul>
<li>List Item 4</li>
<li>List Item 5</li>
<li>List Item 6</li>
</ul>
</td>
</tr>
<tr>
<td>
<p>Avoid losing floppy disks with important school...</p>
</td>
<td>
<a href="http://www.espn.com" target="_blank" rel="nofollow">
<img src="http://www.Facebook.com/pics/htmlT/ahman.gif" class="linksESPN" />
</a>
</td>
</tr>
</table>
HTML Table 2:
List Item 1 List Item 4
List Item 2 List Item 5
List Item 3 List Item 6
HTML tables allow the web designer to align page content in a tabular fashion while spanning
elements horizontally across the web page, rather than stacking them up one on top of another.
The width attribute can be used to define the width of your table. It can be defined as a fixed
width or a relative width. A fixed table width is one where the width of the table is specified in
pixels. For example, this code, <table width="550">, will produce a table that is 550 pixels wide.
A relative table width is specified as a percentage of the width of the visitor's viewing window.
Hence this code, <table width="80%">, will produce a table that occupies 80 percent of the
screen.
There are arguments in favor of giving your tables a relative width because such table widths
yield pages that work regardless of the visitor's screen resolution. For example, a table width of
100% will always span the entire width of the browser window whether the visitor has a
800x600 display or a 1024x768 display (etc). Your visitor never needs to scroll horizontally to
read your page, something that is regarded by most people as being very annoying.
A table can contain an infinite number of table rows. Each table row is essentially a table
element itself, with an opening and closing tag (<tr> </tr>). Table columns are also considered
child elements of HTML tables, and like table rows, an HTML table may contain an infinite
number of table data cells (<td> <tr>).
Table rows and columns are container elements that house other HTML elements such as text
links, images, and lists, as we've seen in previous examples. Below, we've applied a background
color to the table example in order to help distinguish the different table elements.
Use rowspan to span multiple rows merging together table rows and colspan to span across
multiple columns.
Row 3 Cell 1
With the cellpadding and cellspacing attributes, you will be able to adjust the spacing between
table cells. Setting the cellpadding attribute determines how much space will exist between a
table cell border and the elements contained within it, whereas cellspacing determines how much
space will exist between each table cell. Color has been added to the table below to emphasize
these attributes.
Column 1 Column 2
And now we will change the cellpadding of the table and remove the cellspacing from the
previous example. This should clearly demonstrate the difference between cellpadding and
cellspacing.
HTML Code:
<table border="1" cellpadding="10" bgcolor="rgb(0,255,0)">
<tr>
<td><b>Column 1</b></td>
<td><b>Column 2</b></td>
</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>
</tr>
</table>
HTML Cell Pads:
Column 1 Column 2
Tables can be given background colors using the bgcolor attribute. The bgcolor attribute is used
to set the background color of an HTML element. Bgcolor is one of those attributes that has
become deprecated with the implementation of Cascading Style Sheets. The reason we've
included it in this tutorial is because it will give us an opportunity to introduce web colors and
also add some life to our HTML web page as we continue to progress through this tutorial. It will
serve as a visual aid for you as you are learning the mechanics of building a table.
Without much effort, we can bring that boring white web page to life by adding some color with
the bgcolor attribute.
<body bgcolor="silver">
<p>This page now has a SILVER background!</p>
</body>
HTML Bgcolor:
This page now has a SILVER background!
9.5.1 Web Colors
Our example uses the text value, which is one of three different types of color values that can be
used with the bgcolor attribute. Below is a table of the 16 basic HTML color values that are
available to HTML web designers.
HTML Basic Colors:
Black Gray Silver White
While the table above illustrates only 16 colors, 16 is surely not the limit to our color wheel. As
we mentioned, HTML supports three different types of color values including text values (which
we've pretty much covered above), numeric, (RGB) and hexadecimal values. We'll go into more
detail regarding these values so just sit tight. This next example offers a sneak peak at what these
values may look like.
HTML Code:
<table bgcolor="#ff0000" border="1"><tr>
<td>A red colored table background using hexadecimal values "#FF0000".</td>
</tr></table>
A blue colored table background using numeric, RGB values "rgb(0, 0, 255)".
Hexadecimal and numeric color values (RGB) allow HTML developers to expand the color
wheel beyond 16 colors. Way beyond 16, in fact. Nonetheless, there's no need to memorize 256+
unique color combinations; instead, we can use numeric and hexadecimal values and calculate
color shades. We'll show you how to use them in our HTML Color Codes page.
Check out this "Scoreboard" we made with the use of font color and bgcolor!
HTML Code:
<table bgcolor="#000000">
<tr><td bgcolor="#009900" align="right">
<font color="#FFFF00">Green Bay</font></td>
<td><font color="#FFFFFF">13</font></td></tr>
<tr><td bgcolor="#0000FF" align="right">
<font color="#DDDDDD" >New England</font></td>
<td><font color="#FFFFFF">27</font></td>
</tr>
</table>
Scoreboard:
Green Bay 13
New England 27
Let's first review the 16 generic color values we mentioned previously before diving into the
other, more complicated HTML coloring systems of numeric and hexadecimal values.
Any of the string values listed above such as "teal", "black", or "gray" can be passed as a color
value to the HTML bgcolor attribute.
Tips
If you are new to HTML, consider sticking with color names for setting your background
color.
There are 256 "true colors" with hexadecimal values. The colors are made out of hex-
pairs for red, green, and blue. Examples: #99FFCC, #33AA44.
Shades of gray occur when the 3 paired amounts of each color are equal. Example.
"rgb(100,100,100)", "#333333," "#0A0A0A"
Avoid bright, headache-causing color schemes! Keep your coloring distinct and
purposeful.
CHAPTER 10: HTML FORMS
A large part of developing a web based application involves handling interaction with user via
their web browsers. One of the most common tasks in this area of web development involves
presenting the user with forms to collect information, and then processing that information.
Small wonder, then, that forms are the bedrock of user interaction on an Intranet. The ease with
which HTML forms can be created is one of the technology's big benefits, for users and
developers alike. HTML forms provide a rich set of data input features that emulate those found
on common paper forms. For instance, a form can be used to capture manually-entered
information to a database. A related application is the use of forms to input free text, such as a
discussion forum message.
10.2 Introduction
HTML web forms are a composition of buttons, checkboxes, and text input fields embedded
inside of HTML documents with one goal in mind: to capture user input. By doing things such as
providing fields for user data such as names, phone number, and email addresses, web forms
give users the opportunity to interact directly with a webpage.
HTML forms are placed on a web page using the <form> tag. This tag should encapsulate a
series of other form elements, identifying them as a single cohesive web form.
Text Field 1
HTML form elements rely on action and method attributes to identify where to send the form
data for processing (action) and how to process the data (method). In the code above, we've
inserted some make-believe values to represent what a typical HTML form might look like
behind the scenes.
Unfortunately, HTML alone is unable to process form data. A scripting language such as PHP,
PERL, and/or JavaScript must be used with HTML forms to process data captured by HTML
form elements. For the purpose of following along, we can also adjust the action property
slightly to have the form launch an email client instead of processing a make-believe server-side
script. This will provide us with some form interactivity for us as we learn more about HTML
forms.
Checkbox 1
Text Field 1
Now when the SUBMIT button is clicked, the user should see their default email client launch.
HTML forms provide user interaction between visitors and the website while simultaneously
collecting priceless user data from your users. They are a vital tool for any webmaster, and these
days, it is common place to see form elements embedded in every web page.
Tips
Remember to set the name and value attributes for your forms so the document created
will be neatly organized.
Remember to place submit buttons with the form tags to submit the document correctly.
Attribute What it does…
ACTION Specifies the URL to which FORM content is to be sent for processing. This is
(required) usually the address of a script or mailto target.
Example:
<FORM ACTION="mailto:[email protected]">
METHOD HTTP provides several methods for clients to request service: GET, POST, PUT,
HEAD. By far the most prevalent in GET, which gets an object from the server, and
POST, which posts data to an object on the server. As a rule of thumb, use POST
when passing form data to a program, and GET when making a request or
performing a search.
Examples:
<FORM ACTION="http://www.que.com/cgi-bin/readform" METHOD=POST>
<FORM ACTION=http://www.que.com/cgi-
bin/locate?G+Benett METHOD=GET>
HTML input elements are form elements such as text fields, checkboxes, and buttons. The name
comes from the <input> tag, which is the mark-up that identifies web form components. The
<input> tag relies upon a few attributes to classify and name each form item, providing the web
developer with a means to manipulate each element individually.
The type attribute determines what kind of input element to render to the screen. Options here
include: text, checkbox, radio, button, submit, reset, password, and hidden form elements. Each
has its own unique functionality and customizable presentation.
Check Me:
Name:
Yes: No:
10.3.1 Web Forms: Value Attribute
The value attribute plays a different role depending on the type of the input field. For example,
when used with an HTML button, the value attribute defines the text inside of the button. When
used with a text field, the value attribute populates the field with a default value.
David
Name:
Yes: No:
Setting the name and id attributes inside of form elements is a good habit. The element name
and/or id will later serve as the link between your HTML form and any server-side script that
you may deploy later on to process that data. Perhaps the best approach is to use both attributes
in your code, since varying scripting languages demand one identifying attribute over the other.
Check Me:
Name:
Yes: No:
Text fields offer a small rectangular box that's always ready to receive information from viewers.
Users will notice that when they click these fields, the cursor will change from the typical arrow
to a pipe character ( | ), allowing for text entries to be typed inside each input field.
A text field is placed on a web page using the <input> tag, with the type attribute set with a value
of "text".
First: Last:
Text fields are designed to capture single words or phrases from the user. That information may
then be processed through some kind of client/server side script (PHP, PERL, JavaScript). If you
do plan on processing the data, be sure to include the name and id attributes. A descriptive title is
also a great visual aid for providing a tool-tip display for your web elements.
To modify the visual presentation of a text field, one needs to pass an integer value to the size
attribute. The value represents how many characters a text field can display within the text field
window.
As the web designer, it is your job to analyze and predict the average length of characters that
will be entered into each field by your users. First and last names may generally vary from 8-24
characters in length, while a typical email address may range from 12-36 digits.
First:
Last:
If the user happens to enter more digits than the size attribute value, these characters will not be
discarded; it just means that the user will not be able to see all of their input at once. Instead, they
will be forced to scroll to the beginning and end of the input element, which tends to discourage
user interaction.
Maxlength is an optional attribute that accepts an integer value. It allows the developer to restrict
the number of characters a user can type in a specific text field.
Smith
Last:
We've also called upon the value attribute to place some text inside the text fields for you!
HTML password fields are designed to capture user input, but disguise each character with an
asterisk (*) instead of displaying the entered digits. They offer a user on-screen privacy while he
or she is entering a password.
Password fields are placed on a website using the <input> tag and specify a value of "password"
for the type attribute.
Password Field Code:
<form name="myWebForm" action="mailto:[email protected]" method="post">
Password: <input type="password" title="Please Enter Your Password" size="8" /><br />
<input type="submit" value="SUBMIT" />
</form>
Password Fields Sample Output:
Password:
Password form fields may be customized using the same attribute as outlined in the HTML Text
Fields.
First: Last:
Password:
Password fields offer a very thin layer of security by visually concealing passwords; they offer
no security whatsoever against maintaining the integrity of the password data. From data is
processed in plain text and can be readily sniffed by a hacker, unless HTTPS is used to encrypt
the data.
A reset button allows users to basically clear their web form. It wipes values from all fields by
"resetting" the form to its default appearance.
Set the type attribute of the <input> tag to "reset" to incorporate a reset button into a web form.
HTML Reset Button Code:
<input type="reset" value="Reset" />
<input type="reset" value="Start Over" />
Two HTML Reset Buttons:
Placing a reset button inside of a form tag automatically associates the reset button with each
form element and delivers a useful feature for your viewers.
HTML Code:
<form action="myphp.php" method="post"> <input type="text" size="12" maxlength="12" />
<input type="text" size="24" maxlength="24" />
<input type="reset" value="Reset" /> </form>
Reset Forms:
Fill out some information in the field boxes and press reset to experience a reset form!
Submit buttons send form data to a back-end process or application. The back-end process then
verifies and processes the data, eventually passing the information into some database
application.
Set the type attribute of the <input> tag to "submit" in order to place a submit button on a web
page.
Submission buttons send form data to whatever action has been designated by the action attribute
of the encapsulating <form> element. We learned about the action attribute earlier in this
chapter.
If you've been following along, we've also been using the deprecated mailto action to send form
data to our default email client. This will allow us to get a sense of how form values are
transferred to an action.
HTML Code:
<form method="post" action="mailto:[email protected]" >
First:<input type="text" name="First" size="12" maxlength="12" />
Last:<input type="text" name="Last" size="24" maxlength="24" />
<input type="submit" value="Send Email" />
</form>
Form Action:
First:
Last:
Fill out the above form, and as your mail program opens, you can change the email address to a
personal address and then send the results using the form.
Tips
The HTML Button is probably the second most commonly used Graphical User Interface (GUI)
component when developing HTML forms. There are three types of Button object available. The
type= attribute is used to define which type of button is to be created. The three different types
are:
type="SUBMIT" - The submit button. When pressed this button causes the data in the
Form to be sent to the server using the settings defined in the enclosing <Form> tag. If
the onsubmit attribute on the enclosing <form> tag has been specified this will be
executed before the form data is submitted (useful for JavaScript form data validation).
type="RESET" - The reset button. When pressed causes the fields in the Form to be
either cleared, or reset to the defaultValue (if one has been specified).
Setting the type attribute of an <input> tag to checkbox places a checkbox element onto the web
page.
Deploy checkbox elements in a situation when the user must check all boxes that apply (or
none). A scripting language such as PHP will easily handle this form element, returning all
elements the user has checked.
HTML Checkbox Code:
<form name="myWebForm" action="mailto:[email protected]" method="post">
<p>Please select every sport that you play.</p>
Soccer: <input type="checkbox" name="sports" value="soccer" /><br />
</form>
HTML Checkbox Form:
Please select every sport that you play.
Soccer:
Football:
Baseball:
Basketball:
Checkboxes are used for instances where a user may wish to select multiple options, such as in
the instance of a "check all that apply" question.
A checkbox element can be placed onto a web page in a pre-checked fashion by setting the
checked attribute with a "yes" value. By doing so, this element will now default to a checked
status each time the HTML page is loaded.
Soccer:
Football:
Baseball:
Basketball:
Radio form elements allow the user to "bubble" in their choice and limit each question to only
one selection per radio group.
Place a radio element on to your web page by setting the type attribute of the <input> tag to
"radio".
: Greek
: Chinese
By naming each field similarly with a type of cuisine, we have created a relation, or a
"grouping," of radio elements. This is how we link each element together and assure that the user
is able to select only one answer.
Let's now take a look at how we can group together different sets of radio elements and simulate
capturing two pieces of user data: gender and favorite food.
: Greek
: Chinese
: Female
Words/values applied to the value attribute is the value or 'answer' passed to any server-side
script language we may have in place to record the results.
By using the checked attribute, we adjust the form to load with a value already checked as the
default setting.
HTML Code:
<form name="myWebForm" action="mailto:[email protected]" method="post">
<h4>Please select your favorite food category.</h4>
<input type="radio" name="food" checked="yes" /> : Italian<br />
<input type="radio" name="food" /> : Greek<br />
<input type="radio" name="food" /> : Chinese<br />
</form>
Default Italian:
: Italian
: Greek
: Chinese
Using either/or logic, radios provide a very efficient way to capture very specific data from
visitors. Remember to use radio elements only when you'd like the viewer to select only a single
value, just as you might expect to see when taking a multiple-choice test in school.
HTML select fields provide essentially the same functionality as HTML Checkbox Fields. They
allow the user to select one or more values from a pre-determined series of options.
Incorporating a select field into a web page is done using the <select> tag. List values are then
added to the field using the <option> tag, similar to how list items <li> are added to ordered list
elements (<ol>).
By default, select fields, popularly called drop down lists, only allow the user to choose a single
value. This behavior and appearance may be changed by adjusting the multiple and size attributes
as demonstrated below.
With the above settings, the user is now able to select multiple values by pressing and holding
the Control (ctrl) key and clicking each value.
Disabling a selection field is achieved by setting the disabled attribute to "yes". But before doing
that, you should set at least one of the values to be selected. Doing so renders a read-only
selection field on the page that can inform your users of their selections without allowing them to
alter the selection.
HTML Read-Only Selection Field:
<select size="3" name="selectionField" multiple="yes" disabled="yes">
<option value="CA" >California -- CA </option>
<option selected value="CO" >Colorado -- CO</option>
<option value="CN" >Connecticut -- CN</option>
</select>
Hidden fields allow a coder to pass values to form elements in a subtle manner. An experienced
web developer will utilize these fields to pass temporary, or session-based data, from one form to
another or to store information that has already been entered in by the user.
Place a hidden input field into your web forms using the <input> tag and set the type attribute to
"hidden". This field can be customized using any of the attributes discussed in the HTML Input
and HTML Text Fields.
Password:
It is important to note that HTML hidden fields do not offer any data security. Like all HTML
form elements, the data is processed in plain text and is readily accessible by any novice hacker.
Upload fields provide the interface that allows users to select a local file and upload it to the web
server. An upload field renders as two parts -- an empty text field and a Browse button that
opens up a local window explorer on the user's computer. This allows them to quickly browse to
the local file and automatically fills in the file path inside of the text field.
Setting the type attribute of the <input> to "file" places the upload element on a web page.
HTML Upload Field Code:
<form name="myWebForm" action="mailto:[email protected]" method="post">
<input type="file" name="uploadField" />
</form>
HTML Upload Field:
File transferring across the internet is a complicated process and should include many layers of
security. HTML alone cannot ensure safe and secure file transferring, but it can offer a first line
of defense. Using a MAX_FILE_SIZE hidden field can limit the size of files that are transferred.
Placing a restraint on an HTML upload field is accomplished by using a hidden input field with
the name attribute set to MAX_FILE_SIZE.
The value attribute specifies the maximum allowable kilobytes (KB) for any file selected by the
user.
An HTML textarea is an oversized Text Field capable of capturing "blurb" type information
from a user. If you've ever posted on a forum or left feedback on your favorite blog, you
probably do so using an HTML textarea.
Embed textareas in HTML documents using the <textarea> tag. Any text placed between the
opening and closing textarea tags will be rendered inside the textarea element as the "default"
text. This makes for a great way to give users an example or description of how to go about
filling out the text area field. Something like, "Please limit your response to 100 characters,"
would be an ideal description.
As you may have noticed, the attributes cols (columns) and rows control the rendered size of the
textarea. These constraints only impact how the textarea is rendered visually, and in no way do
they limit the maximum number of characters a user can place inside the textarea. In fact, if you
fill up the fields above with text, the fields will just continue to grow as you type and you will be
able to scroll up and down as you please. Limits must be set with JavaScript and/or a server-side
scripting language such as PHP.
The wrap attribute refers to how the user input reacts when it reaches the end of each row in the
text field. Wrapping can be defined using one of three values:
soft
hard
off
"Soft" forces the words to wrap once inside the textarea but once the form is submitted, the
words will no longer appear as such, and line breaks and spacing are not maintained.
"Hard" wraps the words inside the text box and places line breaks at the end of each line so that
when the form is submitted the text will transfer as it appears in the field, including line breaks
and spacing.
"Off" sets a textarea to ignore all wrapping and places the text into one ongoing line.
Setting a "yes" or "no" value for the readonly attribute determines whether or not a viewer has
permission to manipulate the text inside the text field.
As you can see many times word wrapping is often the desired look for your text areas. Since it
makes everything nice and easy to read.
</textarea>
HTML Read Only Text Areas:
As you can see
many times w ord w ra
Since it makes everyt
This read-only behavior allows a web surfer to see and highlight the text inside the element, but
he or she cannot alter it in any way. When highlighted, the user may also Copy (Ctrl + C on a
PC, Ctrl-Click on a Mac) the text to local clipboard and paste it anywhere he/she pleases.
Disabling the textarea altogether prevents the surfer from highlighting, copying, or modifying the
field in any way. To accomplish this, set the disabled property to "yes".
HTML Code:
<textarea cols="20" rows="5" wrap="hard" disabled="yes">
As you can see many times word wrapping is often the desired look for your text areas. Since it
makes everything nice and easy to read.
</textarea>
Disabled Textareas:
As you can see
many times w ord w ra
Since it makes everyt
Keep in mind that just because users are unable to copy from the screen directly doesn't prevent
them from taking a screen capture or extracting the data from the source code. Disabling the
textarea offers no security whatsoever.
CHAPTER 11: MULTIMEDIA ELEMENTS
11.1 Introduction
Information scientists should be concerned with the provision of information in the formats most
suited to the differing needs of various types of user, each of which must be clearly
differentiated. Audiovisual materials can reach out to sections of the public for whom the
traditional print-based materials have little impact, e.g. to those who are reluctant to use the
printed word, and to those with visual and other handicaps. Knowledge of including multimedia
in your website would thus provide you with an upper hand over using plain text. The term
multimedia is used in our context to describe the integrated presentation of text, graphics, sound
and images, including digital video via computer-based media. Multimedia includes the study of
animation and games for mobile devices, web design, digital video, and audio production.
Students who study multimedia are able to create and apply digital content for communication,
education and entertainment.
Inserting music onto a web page is relatively easy these days. In the past, multiple tags had to be
used because browsers did not have a uniform standard for embedded media files. This is
however not the case with the current HTML standards.
Music is inserted onto a web page with the use of the embed tag. There are other ways to link to
music, but embed is now considered the standard for inserting media. Below is an minimalist
example of the embed tag using the src attribute to define the media file's location.
Depending on what kind of media software you or your visitor has installed, the above example
will appear slightly different. To make your embedded player display properly, change the
attributes associated with display.
To customize the appearance of the embedded media player, be sure to set the following
attributes.
To customize the functionality of the embedded media player, be sure to set the following
attributes.
autostart - Allows media player to start automaticcaly (values are "true" and "false")
loop - Sets whether or not the media file will repeat (values are "true" and "false")
volume - Sets the volume of the media file (values range from "0" to "100")
HTML Code:
<embed src="beethoven.mid" autostart="false" loop="false"
volume="60" />
Tips
Be careful when placing music on your website. If done poorly, users will be annoyed by
the music and will leave.
Only set the hidden attribute if you are certain your visitors will not want to stop the
music.
If you want your music to play over and over again, be sure to set the loop attribute to
"true".
Video files, including YouTube videos, are embedded into an HTML document using the
<embed> tag. The src attribute defines what video file to embed into the page. The <embed> tag
does not require a closing tag. Here is a look at the <embed> tag with a global URL. Notice that
its controls, including Play, Stop, Pause, and volume, are already included.
HTML Code:
<embed src="http://www.Facebook.com/files/html/htmlexample.mpeg"
autostart="false" />
You may start and stop your movie files by either pressing the buttons at the bottom of the object
or by single-clicking on the object itself. The movie can be restarted by double-clicking your
mouse.
Flash (.swf) and MOV (.mov) file types are also supported by the <embed> tag.
.swf - Macromedia's Flash file types - very high compression, great for the web!.
.wmv - Microsoft's Window's Media Video file types - good quality, variable
compression.
.mov - Apple's Quick Time Movie format - good quality, variable compression.
.mpeg - the accepted standard for web movie files created by the Moving Pictures Expert
Group - good quality, variable compression.
The list above outlines some of the most common "internet-ready" video files. Macromedia's
.swf and .mpeg formats may be the best options for use with the web because the high
compression rate of these file types reduces file size and expedites the download/buffering
periods for your page visitors.
You may also simply place the URL of your media files into the href attribute of an anchor tag,
much like the concept of "thumbnailing" images.
HTML Code:
<a href="http://www.Facebook.com/pics/flash/motiontween1easy.swf">
motiontween1easy.swf</a>
Flash Media:
motiontween1easy.swf
11.3.2 YouTube Videos
YouTube videos can be included in HTML documents, and Google offers the code to do so right
on the same page as the video itself!
The code offered by YouTube includes a small handful of parameters that help customize the
embedded video object, and if you dive deep enough into the code, you will be able to identify
the <embed> element and see the src attribute pointing to the URL of the media file.
To customize the functionality of the embedded media player, be sure to set any of the following
attributes.
autostart - Controls the media's ability to start without prompting (values are "true" or
"false")
hidden - Controls whether or not the play/stop/pause embedded object is hidden or not
(values are "true" or "false"; hide your embeded media if you just want background
noise)
loop - Controls the ability of the media to continuously play (values are "true" and
"false")
playcount - Sets a playcount which means the media will repeat itself x number of times,
instead of continuously as with the loop attribute above (a playcount of "2" will repeat
the video twice)
volumn - Sets a numeric value for the loudness of your media (values are "0" through
"100")
CHAPTER 12: META TAGS AND META DATA
Meta tags are used to supply information for search engines that will not be seen by the web
surfer. These invisible units provide a flag for search engines to investigate and will then present
that data to any potential users that stumble across your site through a search engine.
In the past, meta tags were the primary means for your site to be recognized by web spiders, but
webmasters abused meta tags to improve their rankings in search engines. As a result, search
engines have since modified their approach to keep results accurate. They now rely less on meta
tags. Nevertheless, you should still include meta for those search bots that still do recognize
them.
Search engines are the compasses of the web and help users navigate from site to site. Chances
are, if you've used a search engine, you've probably seen the description meta tag in action.
Meta elements must be placed inside of the <head> element in order for them to be recognizable
by web crawlers and bots. The <meta> tag generally requires the name and content attributes to
be working together to present your web page in a good light.
HTML Code:
<head>
<meta name="description" content="Facebook contains webmaster tutorials." />
</head>
The description meta element allows the developer to summarize the content that can be found
on the page and is often the first chance you'll have to attract visitors. These brief narratives and
hooks are often the only opportunity you'll have to generate a lasting first impression.
Keywords and/or phrases may be placed inside the keyword meta element. You should specify
the most popular search terms you believe someone would use to reach your website. A few
years back, you could spam this meta tag with any and every keyword possible to gain ranking
on search engines. Now, however, repeated words, or words that do not pertain to the content of
the site, will not benefit your search engine rankings.
HTML Code:
<head>
<meta name="keywords" content="keyword, key keywords, etc" />
</head>
Separate each phrase/word with a comma to create large lists. An example of the keywords meta
tag for Facebook.com would go something like this:
HTML Code:
<head>
<meta name="keywords" content="HTML, XHTML, CSS, tutorials, Facebook" />
</head>
Keep in mind that driving traffic and having your site listed high in the search engine rankings is
not as easy as placing keywords inside your meta element. The phrase "Search Engine
Optimization (SEO)" was coined to describe the rigorous process involved in achieving rankings
in search engines. While meta tags do play a small role in this process, they are by no means a
one-stop shop for your SEO needs.
Later down the road, you may need to redirect traffic to another domain. A common reason
might be that you have just purchased a better domain name and would like to retain your old
visitors, yet still use your new domain. With the refresh meta tag, you will be able to redirect
visitors to the website of your choice or simply refresh your own page to update dynamic content
automatically.
For the refresh meta tag, the content attribute accepts two arguments separated by a semicolon
(;). The first argument specifies the number of seconds between refreshes or redirection and the
2nd argument is a URL of where the browser will relocate.
The above code refreshes Facebook's home page every 10 seconds. A quick refresh may be
necessary for news, stocks, or any other time-sensitive information. The most common use for
this type of meta tag, however, is redirection. To redirect a viewer automatically, just change the
URL to the new site, like shown below. This code will send your visitors to espn.com after
landing at your site for five seconds.
The revised meta tag records when the last update was done to the site.
HTML Code:
<head>
<meta name="revised" content="Happy New Year: 1/1/2003" />
</head>
Tips
It's important not to repeat words in the description or keywords meta tags
Meta is not the only way to have your site seen by search engines. Do not rely on meta
tags alone to get your website listed on search engines.
If your domain (.com) ever changes, remember to place a simple, "Our site has moved"
message as the existing domain, and then use a redirect meta tag to make life easier for
your viewers that already may have your site bookmarked.
CHAPTER 13: HTML STYLE ATTRIBUTES
Understanding the HTML style attribute will provide you with a preview into the Cascading
Style Sheet (CSS) world. In fact, the code we'll be using with style is indeed CSS code known as
Internal CSS. CSS styling brings a whole new dimension to a website and offers endless
customization of HTML elements and web page design.
13.2 Introduction
When the style attribute was introduced into the HTML language along with CSS, a number of
HTML attributes and tags became obsolete. Manipulation of the fonts and color of HTML
elements is now accomplished through CSS styling, instead of stacking bulky formatting tags
one inside the other.
In the HTML Font lesson, we achieved similar results, but the code used to do so was
cumbersome and inefficient.
13.3 Styling
As we mentioned, the values passed to the style attribute are actually CSS code. This means that
we can go ahead and pass a series of values at once, changing several properties in one go.
Simply separate each CSS attribute with a semicolon (;).
Inline CSS with the HTML style attribute offers a great way to improve the visual display of web
elements and pages. With this new understanding of HTML and CSS, you're well on your way to
mastering web design.
With these text elements now grouped together under a <div> element, we can alter the
appearance of each underlying element collectively by applying a style attribute to the <div> tag.
Subtitle
Elements housed within a <div> tag acquire any styles or properties applied to the master div
element. Therefore the paragraph and heading elements should now be rendered blue in a
Helvetica font. In addition, we've applied a border to the <div> element just to help visualize the
grouping of elements together.
Placing <div> elements inside of other <div> elements allows these elements to be further
subdivided.
Section 1
Section 2
This concept is the foundation of which most web pages are now built. HTML documents that
are properly divided and subdivided are easy to maintain and modify.
13.4 Page Layouts and Templates
HTML layout is very basic. Not many options exist with the body tag alone. Tables, on the other
hand, are the bread and butter of HTML layouts. Any element may be placed inside of a table,
including tables themselves!
HTML Code:
<table id="shell" bgcolor="black" border="1" height="200" width="300">
<tr>
<td>
<table id="inner" bgcolor="white" height="100" width="100">
<tr>
<td>Tables inside tables!</td>
</tr>
</table>
</td>
</tr>
</table>
The white table (identified as inner) exists inside of the (shell) table, the black one. A light bulb
should be going off inside of your head as you explore how this system will allow for the
creation of limitless layouts.
A fairly standard layout consists of a banner near the top, navigation, and your content or display
box. These are the backbone to any great website.
HTML Code:
<table cellspacing="1" cellpadding="0" border="0"
bgcolor="black" id="shell" height="250" width="400">
<tr height="50">
<td colspan="2" bgcolor="white">
<table title="Banner" id="banner" border="0">
<tr><td>Place a banner here</td></tr>
</table>
</td>
</tr>
<tr height="200">
<td bgcolor="white">
<table id="navigation" title="Navigation" border="0">
<tr><td>Links!</td></tr>
<tr><td>Links!</td></tr>
<tr><td>Links!</td></tr>
</table>
</td><td bgcolor="white">
<table title="Content" id="content" border="0">
<tr><td>Content goes here</td></tr>
</table>
</td>
</tr>
</table>
Basic Layout:
Place a banner here
Links!
Links!
This approach is basic, yet organized. The code becomes complex rather fast, so you will need to
be sure to properly assign height and width values to your tables as well. The more specific you
are about heights and widths, the less room there will be for error and debugging.
HTML Code:
<table id="shell" title="Shell" height="250" width="400"
border="0" bgcolor="black" cellspacing="1" cellpadding="0">
<tr height="50">
<td bgcolor="white">
<table title="banner" id="banner">
<tr><td>Banner goes here</td></tr>
</table>
</td>
</tr>
<tr height="25">
<td bgcolor="white">
<table title="Navigation" id="navigation">
<tr><td>Links!</td>
<td>Links!</td>
<td>Links!</td></tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="white">
<table title="Content" id="content">
<tr>
<td>Content goes here</td>
</tr>
</table>
</td>
</tr>
</table>
Basic Layout 2:
Banner goes here
The code is quite a lot to look at, SO break it up and organize it in your own way to make things
easier for you.
Tips
Your code can become quite complicated rather fast. Keep an organized spacing system
so it becomes easy to spot where one table ends and the other beings.
Use cellspacing to add usable borders to your content.
Keep things neat. Be creative, yet organized.
CHAPTER 14: HTML FRAMES
Frames allow for multiple .html documents to be displayed inside of one browser window at a
time. This means that one page has no content on it, but rather tells the browser which web pages
you would like to open. With the addition of CSS and PHP, frames have become outdated, but if
you wish to use them, read on.
14.2 Introduction
Frames are most typically used to have a menu in one frame, and content in another frame. When
someone clicks a link on the menu, that link is then opened in the content page. Here is a classic
example of a basic "index" frameset with a menu on the left and content on the right.
HTML Code:
<html>
<body>
<frameset cols="30%,*">
<frame src="menu.html">
<frame src="content.html">
</frameset>
</body>
</html>
Frame Set:
Here's the example: Frame Index
frameset - The parent tag that defines the characteristics of this frames page. Individual
frames are defined inside it.
frameset cols="#%, *" - The width that each frame will have. In the above example, we
chose the menu (the 1st column) to be 30% of the total page and used a "*", which means
the content (the 2nd column) will use the remaining width for itself (70%).
frame src="" - The URL of the web page to load into the frame.
A good rule of thumb is to call the page which contains this frame information "index.html", as
that is typically a site's main page.
Add a row to the top for a title and graphics with the code as follows:
HTML Code:
<html>
<body>
<frameset rows="20%,*">
<frame src="title.html">
<frameset cols="30%,*">
<frame src="menu.html">
<frame src="content.html">
</frameset>
</frameset>
</body>
</html>
You've probably noticed those ugly gray lines that appear between the frames. It is possible to
remove these and manipulate the spacing between frames with frameborder and framespacing.
These attributes appear within the frameset tag.
Note: Framespacing and border are the same attribute, but some browsers only recognize one or
the other, so use both, with the same value, to be safe.
HTML Code:
<html>
<body>
<frameset border="0" frameborder="0" framespacing="0" rows="20%,*">
<frame src="title.html">
<frameset border="0" frameborder="0" framespacing="0" cols="30%,*">
<frame src="menu.html">
<frame src="content.html">
</frameset>
</frameset>
</body>
</html>
Frame Borders:
Here's a visual:Visual
How nice would it be to make each menu link load into the content page? We do this by naming
each frame and setting the correct base target inside "menu.html".
HTML Code:
<html>
<body>
<frameset rows="20%,*">
<frame name="title" src="title.html">
<frameset cols="30%,*">
<frame name="menu" src="menu.html">
<name="content" src="content.html">
</frameset>
</frameset>
</body>
</html>
HTML Code:
<html>
<head>
<base target="content">
</head>
<body>
<!-- Content Goes Here -->
</body>
</html>
Frame Target:
Here's the Visual: Visual
We first named the content frame "content" on our frame page, and then we set the base target
inside "menu.html" to point to that frame. Our frame page is now a perfectly functional menu
and content layout!
It's possible to further customize the <frame> tag using the noresize and scrolling attributes.
HTML Code:
<html>
<body>
<frameset border="2" frameborder="1" framespacing="2" rows="20%,*">
<frame src="title.html" noresize scrolling="no">
<frameset border="4" frameborder="1" framespacing="4" cols="30%,*">
<frame src="menu.html" scrolling="auto" noresize>
<frame src="content.html" scrolling="yes" noresize>
</frameset>
</frameset>
</body>
</html>
Noresize and Scrolling:
Here's the Visual: Visual
noresize - Determines whether the frames can be resized by the visitor or not. (values
"true" and "false")
scrolling - Determines whether scrolling is allowed in the frame or not (values "true" and
"false")
We set the scrolling for our content frame to "yes" to ensure our visitors will be able to scroll if
the content goes off the screen. We also set the scrolling for our title banner to no, because it
does not make sense to have a scrollbar appear in the title frame.
Tips
Frames can be simple and well-organized. However, they are usually viewed as
unacceptable by most web designers.
Always set the scrolling and resize options to optimize load time.
Using a simple menu and content frame design can reduce updates to massive sites.
Instead of updating the menu on each page, you could simply update the menu.html file
and be done with it!
CHAPTER 15: SCRIPTING LANGUAGES
15.1 Introduction
A client-side script is a program that may accompany an HTML document or be embedded
directly in it. The program executes on the client's machine when the document loads, or at some
other time such as when a link is activated. HTML's support for scripts is independent of the
scripting language.
Scripts offer authors a means to extend HTML documents in highly active and interactive ways.
For example:
Scripts may be evaluated as a document loads to modify the contents of the document
dynamically.
Scripts may accompany a form to process input as it is entered. Designers may
dynamically fill out parts of a form based on the values of other fields. They may also
ensure that input data conforms to predetermined ranges of values, that fields are
mutually consistent, etc.
Scripts may be triggered by events that affect the document, such as loading, unloading,
element focus, mouse movement, etc.
Scripts may be linked to form controls (e.g., buttons) to produce graphical user interface
elements.
There are two types of scripts authors may attach to an HTML document:
Those that are executed one time when the document is loaded by the user agent. Scripts
that appear within a SCRIPT element are executed when the document is loaded. For user
agents that cannot or will not handle scripts, authors may include alternate content via the
NOSCRIPT element.
Those that are executed every time a specific event occurs. These scripts may be assigned
to a number of elements via the intrinsic event attributes.
The most popular scripting languages that are commonly used in HTML to make web pages
come alive are JavaScript, PHP, Perl, ASP and VBScripts.
With HTML scripts, you can create dynamic web pages, make image rollovers for really cool
menu effects, or even validate the data on your HTML forms before users submit their
information. However, JavaScript and VBScript are very complicated compared to HTML. It
may be simpler just to download someone else's scripting code and modify it for use on your
web page (if they have given you permission to do so, of course!).
If you want to insert JavaScript code into your HTML, you are going to use the <script> tag.
Below is the correct code to insert embedded JavaScript code onto your site.
HTML Code:
<script type="text/javascript">
<!--script
***Some JavaScript code should go here***
-->
</script>
For JavaScript, you set the type attribute equal to "text/javascript", which is similar to the process
of specifying CSS. We can also include a comment around the JavaScript code. This will prevent
browsers that do not support JavaScript or have had JavaScript disabled from displaying the
JavaScript code in the web browser.
15.3 VBScript
To insert VBScript code onto your website, you must once again make use of the <script> tag.
Below is the correct code to insert VBScript code onto your site.
HTML Code:
<script type="text/vbscript">
<!--script
***The VBScript code should go in this spot***
-->
</script>
For VBScript, you set the type attribute equal to "text/vbscript", which is similar to specifying
CSS. We also include a comment around the VBScript code. This will prevent browsers that do
not support VBScript or have had VBScript disabled from displaying the VBScript code in the
web browser.
Scripting languages such as JavaScript and VBScript must be commented out as well. You will
learn that it is only once they are placed within the <script> tags that the browser executes the
scripts without causing errors.
HTML Code:
<script>
<!--
document.write("Hello World!")
//-->
</script>
With this example, we are jumping far ahead. Just be sure you understand when to use comments
and where to look for them. They are a very useful tool for any large HTML project.