SlideShare ist ein Scribd-Unternehmen logo
1 von 182
Downloaden Sie, um offline zu lesen
1 
Introduction to Web and HTML 
Chapter 
What is the World Wide Web? 
World Wide Web- the web, for short- is a network of computer able to exchange 
text, graphics, and multimedia information via the internet. By sitting at a computer that is 
attached to the web, using either a dialup phone line or a much faster broadband (Ethernet, 
cable, or DSL connection, you the can visit web- connecters next door, at a nearby university, or 
halfway around the world. And you can take full advantage of the resources these computers 
make available, including text, graphics, videos, sounds, and animation. Think 
Of the web as the multimedia version of the internet, and you’ll be right on the 
mark. The World Wide Web has come a long way from its humble beginnings, most internet 
historians recognize Gopher as the precursor to the web. Gopher was a revolutionary search tool 
that allowed the user to search hierarchical archives of textual documents. It enabled internet 
users to easily search, retrieve. And share information. Today’s World Wide Web is capable of 
delivering information via any number of medium-text, audio, video. The content can be 
dynamic and even interactive. However, the web is not a panacea. The standards that make up 
the HTTP protocol are implemented in different ways by different browsers. What works on one 
platform may not work the same, if at all, on the next. Newly web- enabled devices- PDAs, cell 
phones, appliances, and so on- are still searching fop a suitable form of HTML to standardize 
on. 
How Does the web work? 
The computers that make all these web pages available are called web servers. On 
any computer that’s connected to the web, you can rub nab application called a web browser. 
Technically, a web browser is called a web client-that is, a program that’s able to contact a web 
server and request Information 
When the web server receives the requested information, it looks for this 
information within its file system, and sends out the requested information via the internet. They 
all speak a common “language,” called Hyper Text Transfer protocol (HTTP). (HTTP isn’t 
really a language like the ones people speak. It’s a set of rules or procedures, called protocols 
that enable computers to exchanges information over the web.) Regardless of where these 
computer reside-china., Nor- way, or Austin, Texas-they can communication with each other 
through HTTP. 
The following illustrates how HTTP works (see figure) 
1
· Most web pages contain hyperlinks, which are specially formatted words or 
phrases that enable you to access another page on the web. Although the hyperlink usually 
doesn’t make the address of this page visible, it contains all the information needed for your 
computer to request a web page form another computer. 
· When you click the hyperlink your computer sends a message called an HTTP 
2 
request. The message says, in effect,” Please send me the web page that I want.” 
The web server receives the request, and looks within its stored files for the web 
page you request. When it finds the web page, it sends it to your computer, and your web 
browser displays it. If the page isn’t founds, you see an error message, which probably the 
HTTP code for this error’ 404 “Not found.” 
Figure: The client requests the page. Then the server evaluates the request and 
server the page or an error message. 
What Is Hypertext? 
You probably noticed the word “hypertext” in the spelled- out version of HTTP, 
Hypertext Transfer Protocol. Originated by computing pioneer Theodore Nelsons, the term 
“hypertext “doesn’t mean “text that can’t sit still,” although some web authors do use a much-despised 
HTTP code that makes the text blink on- screen. Insert, the tern is an analogy to a time-honored 
(but physically impossible) science fiction concept, the hyperspace jump, which 
enables a starship to go immediately form one star system to another. Hypertext is a types of text
that contains hyperlinks (or just links for short), which enable the reader to jump form ones 
hypertext page to another. 
You may also hear the word hypermedia. A hypermedia system works just like 
hypertext, except that it includes graphics, sounds, videos, and animation as well as text. In 
contrast to ordinary text, hypertext gives readers the ability to choose their own path through the 
material that interests them. A book is designed to be read in sequence; page 2 follows page 1, 
and so on. Sure, you can skip around, but books don’t provide much help, beyond including an 
index. Computer – based hypertexts let readers jump around all they want. The computer part is 
important because it’s hard to build a hypertext system out of physical media, such as index 
cards or pieces of paper 
The web is a giant computer- based hypermedia system, and you’ve probably 
already done lost of jumping around from one page to another on the web-it’s called surfing. If 
one web page doesn’t seem all that interesting once you visit, you can click another link that 
seems more related to your needs (and so on). The web makes surfing so easy that you’ll need to 
give some thought to keeping people on your sites-keeping them engaged and interested-so they 
won’t surf away! 
Where Dose HTML Fit In? 
Hypertext Markup Language (HTML) enables you to mark up text so that it 
can function as hypertext on the web. The term markup comes form printing; editors mark up 
manuscript pages with funny- looking symbols that tell printer how to print the page. HTML 
consists of its own set of funny-looking symbols that tell web browsers how to display the page, 
These symbols, called elements, include the ones needed to create hyperlinks. 
The Hyper Text Markup Language (HTML) IS A Simple markup language that 
describes the structure and behavior of Web document. HTML is the standard language that all 
Web browsers are designed to; understand and interpret. HTML is implemented using another 
larger markup language—the Standard Generalized Markup Language, usually known by its 
acronym, SGML 
The invention of HTML 
HTML and HTTP were both invented by Tim Berners-Lee, who was then working 
as a computer and networking specialist at a Swiss research institute. He wanted to give the 
Institute’s researchers a simple markup language, which would enable them to; share their 
research pares via the internet. Berners-Lee based HTMNL on Standard Generalized Markup 
Language (SGML), an international standard for mar5king up text for presentation on a variety 
of physical devices. The basic idea of SGML is that the document’s structure should be 
separated form its presentation: 
3
· Structure refers to the var5ious components or parts of a document that authors 
create, such as titles, paragraphs, headings, and lists. Fir example, you’re reading an item in an 
unordered list, as it is termed in SGML (most people use the more familiar bulleted list). In 
SGML, you markup this item as a bulleted list, but you don’t say anything about how it’s 
supposed to look. That’s left up to whatever device displays or prints the marked-up file 
· Presentation refers to the way these various components are actually displayed 
by a given media device, such as a computer or a printer. For example, this book displays this 
bulleted list item with an indentation and other special formatting. 
· What’s so great about separating structure from presentation? There are several 
4 
very important advantages: 
· Authors usually aren’t very good designers. It’s wise, especially in large 
organizations. To let writers compose their documents, and let designers worry about how the 
documents are supposed to look. That’s particularly true when an organization has a corporate 
look or style, such as Apple computer’s standard typeface, which you’ll see in all of its 
documents. T he designers make sure that every document produced with the organization 
conforms to that style. So SGML doesn’t contain any features that control presentation. 
· If markup consists of structure alone, the document’s appearance can be 
changed quickly. All that’s necessary is to change the presentation settings on whatever device 
is displaying the document. 
· Documents containing only structural markup are much easier and cheaper 
to maintain. When presentation markup is included along with structural markup, the document 
becomes an unmanageable mess, and maintenance costs skyrocket. 
· If a document contains only structural markup, it is more accessible to 
people with limited vision or other physical limitations. For example, a document marked up 
structurally might be presented by a Braille printer for those with limited vision, or by a text 
reader for those with limited hearing. 
Sounds great, right? Still, from the beginning, HTML didn’t make the structure 
versus presentation distinction as clearly as SGML purists would have liked. And as HTML 
developed and the internet became a commercial network, Web authors demanded more tools to 
make their documents look attractive on-screen. The companies that make web browsers 
responded by introducing new, nonstandardized HTML elements that contained presentation 
information. By 1996, many web experts were worried that HTML standards were spiraling out 
of control. The newly founded world wide consortium, hoping to deep at least some kind of 
standard in place, tried to standardize existing practices, including the use of presentation and 
structure. The result was the W3C’s HTML 3.2 standard, which is still widely used. But
organizations found that HTML3.2 exposed them to excessive maintenance cists. The SGML 
purists were right: Structure and presentation should have been kept separate 
5 
A Short History of HTML 
To date, HTML has gone through four major standards, including the latest 4.01. 
In addition to the HTML standards, cascading style sheets and XML have also provided 
valuable contributions to Web standards. 
The following sections provide a brief overview of the various versions and 
technologies. 
HTML 1.0 
HTML 1.0 was never formally specified by the W3C because the W3C came 
along too late It was the original specification Mosaic 1.0 used, and it supported few element. 
What you couldn’t do on a page is more interesting than what you could do. You couldn’t set 
the background color or background image of the page. There were no tables or frames. You 
couldn’t dictate the font. All inline images had to be GIFs; JPEGs were used for out-of-line 
images. And there were no forms. 
Every page looked pretty much the same: gray background and Times Roman 
font. Links were indicated in blue until you’d visited them and then they were red. Because 
scanners and image- manipulation software weren’t as available the, image limitation wasn’t a 
huge problem. HTML 1.0 was only implemented in Mosaic and Lynx (a text-only browser that 
runs under UNIX). 
HTML 2.0 
Huge strides forward were made between HTML 1.0 AND html2.0. An HTML 
1.1 actually did exist, created by Netscape to support what its first browser could do. Because 
only Netscape and Mosaic were available at the time (both written under the leadership of Marc 
Andreesen), browser makers were in the habit of adding their own new features and creating 
names for HTML elements to use those features. 
Between HTML1.0 and HTML 2.0, the W3C also came into being, under the 
leadership of Tim Berners-Lee, founder of the web. HTML 2.0 was a huge improvement over 
HTML 1.0 Back-ground colors and images could be set. Forms became available With a limited 
set of fields, but nevertheless, for first time, visitors to a web page could submit information. 
Tables also became possible.
6 
HTML 3.2 
Why no 3.0? The W3C couldn’t get a specification out in time for agreement by 
the members. HTML 3.2 was vastly richer than HTML 2.0. It included support for style sheets 
(CSS level 1). Even though CSS was supported in the 3.2 specification, the browser 
manufacturers didn’t support CSS well enough for a designer to make use of it. HTML 3.2 
expanded the number of attributes that enabled designers to customize the look of a page 
(exactly the opposite of HTML 4). HTML 3.2 didn’t include support for frames, but the browser 
makers implemented them anyway. 
NOTE a page with two frames is actually processed like three separate pages 
within your browser. The outer page is the frameset. The frameset indicates to the browser, 
which pages go where in the browser window. Implement a web site. A common use for frames 
is navigation in the left pane and content in the right. 
HTML 4.0 
What does HTML 4.0 add? Not so much new elements- although those do exist-as 
a rethinking of the direction HTML is taking. Up until now, HTML has encouraged interjecting 
presentation information into the page. HTML 4.0 now clearly deprecates any uses of HTML 
that relate to forcing a browser to format an element a certain way. All formatting has been 
moved into the style sheets. With formatting information strewn throughout the page, HTML 
3.2 had reached a point where maintenance was expensive and difficult. This movement of 
presentation out of the document, once and for all, should facilitate the continued rapid growth 
of the web. 
Tip Use the W3C MarkUp validation service, available at http://validator .w3.org/ 
, to check your HTML against most of the versions mentioned in this chapter. 
XML 1.0 
Extensible Markup Language (XML) was originally designed to meet the needs of 
large-scale electronic publishing. As such, it was designed to help separate structure from 
presentation and provide enough power and flexibility to be applicable in a variety of publishing 
applications. In fact, many modern word processing contain XML components or even export 
their documents in XML-compliant formats. 
CSS 1.0 AND 2.0 
Cascading Style Sheets (CSS) were designed to help move formatting out of the 
HTML specification. Much like styles in a word processing program, CSS provides a 
mechanism to easily specify and change formatting without changing the underlying code. The
“cascade” in the name comes from the fact that the specification allows for multiple style sheets 
to interact, allowing individual Web document to be formatted slightly different from their kin 
(following department document guidelines but still adhering to the company standards, for 
example). The second version of CSS (2.0) builds on the capabilities of the first version, adding 
more attributes and properties for a Web designer to draw upon. 
7 
HTML 4.01 
HTML 4.01 is a minor revision of the HTML 4.0 standard. In addition to fixing 
errors identified since the inception of 4.0, HTML 4.01 also provides the basic for meaning of 
XHTML elements and attributes, reducing the size of the XHTML 1.0 specification 
XHTML 1.0 
Extensible Hyper Text Markup Language (XHTML) is the first specification for 
the HTML and XML cross-breed. XHTML was created to be the next generation of markup 
language, infusing the standard of HTML with the extensibility of XML. It was designed to be 
used in XML compliant environments, yet compatible with standard HTML 4.01 user agents. 
What is an HTML File? 
· HTML stands for Hyper Text Markup Language 
· An HTML file is a text file containing small markup tags 
· The markup tags tell the Web browser how to display the page 
· An HTML file must have an htm or html file extension 
· An HTML file can be created using a simple text editor 
Creating an HTML Document 
If you are running Window, start Notepad. 
If you are on a Mac, start simple Text. 
In OSX start Text Edit and change the following preferences: Open the “Format” 
menu and select “Plain text” instead of “Rich text “. Then open the “preferences “window under 
the “Text Edit” menu and select “Ignore rich text commands in HTML file “. Your HTML code 
will probably not work if you do not change the preferences above! 
Type in the following text:
8 
<html> 
<head> 
<title>Title of page </title> 
</head> 
<body> 
This is my first homepage. <b> This text is bold 
</b> 
</body> 
</html> 
Save the file as “mypage.html”. 
Start your internet browser “Open “ (or “Open page”) in the file menu of your 
browser. A dialog box will appear. Select “Browser” (or “Choose File “) and locate the HTML 
file you just created – “mypage.htm” –select it and click “Open “. Now you should see an 
address in the dialog box, foe example “C:My Documentmypage.htm”. Click OK, and the 
browser will display the page. 
The first tag in your HTML document is <html>. This tag tells your browser that 
this is the state of an HTML document. The last tag in your document is </html>. This tag tells 
your browser that this is the end of the HTML document. The text between the <head> tag and 
the </head> tag is header information. Header information is not displayed in the browser 
window. 
The text between the <title> tags is the title of your document. The title is 
displayed in your browser’s caption. The text between the <body> tags is the text that will be 
displayed in your browser. The text between the <b> and </b> tags will be displayed in a bold 
font. 
HTM or HTML Extension? 
When you save an HTML file, you can use either the .htm or the html extension. 
We have used .htm in our examples. It might be a bad habit inherited from the past when some 
of he commonly used software only allowed three letter extensions. With newer software we 
think it will be perfectly safe to use.html.
9 
Basic HTML Tags And Elements 
Chapter 
HTML Elements 
HTML documents are text files made up of HTML elements. 
HTML elements are defined using HTML tags 
HTML Tags 
· HTML tags are used to mark- up HTML elements 
· HTML tags are surrounded by the two characters <and> 
· The surrounding character are called angle brackets 
· HTML tags normally come in pairs like <b> and </b> 
· The first tag in a pair is the state tag, the second tag is the end tag 
· The text between the start and end tags is the element content 
· HTML tags are not case sensitive, <b> means the same as <B> 
HTML Elements 
Remember the HTML example from the previous page: 
<html> 
<head> 
<title> Title of page </title> 
</head> 
<body> 
This is my first homepage. 
</body> 
</html> 
This is an HTML element: 
2
10 
<b> This text is bold </b> 
The HTML element starts with a start tag: 
<b> 
The content of the HTML element is: This text is bold 
The HTML element ends with an end tag: </b> 
The purpose or the <b> tag is to define an HTML element that should be displayed 
as bold. 
This is also an HTML element: 
<body> 
This is my first homepage. <b> This text is bold</b> 
</body> 
This HTML element starts with the stat tag <body>, and ends with the end tag 
</body> 
The purpose of the <body> tag is to define the HTML element that contains the 
body of the HTML document. 
Why do We Use Lowercase Tags? 
We have just said that HTML tags are not case sensitive: <b> means the same as 
<b>. If you surf the web, you will notice that plenty of web sites use uppercase HTML tags in 
their source code. We always use lowercase tags. Why? 
If you want to follow the latest web standards, you should always use lowercase 
tags. The World Wide Web Consortium (W3C) recommends lowercase tags in their HTML 4 
recommendation, and XHTML (the next generation HTML) demands lowercase tags. 
Basic HTML Tags 
The most important tags in HTML are tags that define headings, paragraphs and 
line breaks. 
The best way to learn HTML is to work with examples. We have created a very 
nice HTML editor for you. With this editor; you can edit the HTML source code if you like, and 
click on a test button to view the result. 
The Overall Structure: HTML, Head, and Body 
All HTML documents have three, document-level tags in common. These 
tags,<html>, <head>,and <body>, delimit certain sections of the HTML document. 
The <html> tag
The <html> tag surrounds the entire HTML document. This tag tells the client 
11 
browser where the document begins and ends. 
<html> 
…..document contents…. 
</html> 
Additional language options were declared within the <html> tag in previous 
versions of HTML. 
However, those options (notably lang and dir) have been deprecated in HTML 
version 4.0 The language and directional information is routinely contained in the <head> 
section. A typical <head> section could resemble the following: 
<head> 
<link rel=”stylesheet” type=”text/css” href=”/styles.css”> 
<title>TITLE OF THE Document</title> 
<meta name= “description” content= “Sample Page”> 
<meta name= “keywords” content= “sample, heading, page”> 
<script language= “JavaScript “> 
Function New Window (url) { 
Fin= window. open (url,””, 
“width=800, height=600, scrollbars=yes, resizable=yes”); 
} 
</script> 
</head> 
Most of the content within the <head> section will not be visible on the rendered 
page in the client’s browser. The <title> element determines what the browser displays as the 
page title-on Windows machines, the document title appears in the browser’s title bar, as shown 
in Figure2-1. 
Document title
Figure: In windows, the document’s <title> appears in the browser’s title bar. 
The main, visual content of the HTML document is contained within <body> tags. 
Note that with HTML version 4.0 most attributes of the <body> tag have been deprecated in 
favor of specifying the attributes as styles. In previous version Of HTML, you could specify a 
bevy of options, including the document background, text and link colors. The onload and 
onunload attributes of the <body> tag, as well as global attributes such as style, are still valid. 
However, you should specify the other attributes in styles instead of within the <body> tag, such 
as in the following example: 
12 
<html> 
<head> 
<title> Document Title</title> 
<style type=”text/css”> 
Body {background:black; color:white} 
a: link {color: red} 
a: visited {color: blue} 
a: active {color: yellow} 
</style> 
</head> 
<body> 
… document body … 
</body> 
</html> 
The Head Element 
The head element contains general information, also called meta-information, 
about a document. Meta means “information about”. 
You can say that meta-data means information; also called meta-information 
means information about information. 
Information inside the Head Element 
The elements inside the head element should not be displayed by a browser 
According to the HTML standard, only a few tags are legal inside the head 
section. These are: <base>, <link>, <meta>, <title>, <style>, and <script>. 
Look at the following illegal construct:
13 
In this case the browser has two options: 
· Display the text because it is inside a paragraph element 
· Hide the text because it is inside a head element 
If you put an HTML element like <h1> or <p> inside a head element like this, 
most browser will display it, even if it is illegal. 
Should browser forgive you for errors like this? We don’t think so. Others do. 
Head Tags 
Tag Description 
<head> Defines information about the 
Document 
<title> Defines the document title 
<base> Defines a base URL for all 
The links on a page 
<link> Defines a resource reference 
<meta> Defines meta information 
Tag Description 
<!DOCTYPE> Defines the document type. This 
tag goes before the <html> start 
tag, 
Headings 
HTML has six predefined heading tags. Heading use <h> tags containing the 
number of the heading. The <h1> tag specifies the highest (most important) level of headings, 
while <h6> specifies the lowest (least important) level of headings. 
As with most textual documents, HTML documents use larger fonts to specify 
higher- level headings. For example consider the following example and its output, 
<html> 
<head> 
<p>This is some text</p> 
</head>
14 
<head> 
<title> Heading Tags </title> 
</head> 
<body> 
<h1> Heading Level 1</h1> 
<h2>Heading Level 2</h2> 
<h3>Heading Level 3</h3> 
<h4>Heading Level 4</h4> 
<h5>Heading Level 5</h5> 
<h6>Heading Level 6</h6> 
<p>Normal body text.</p> 
</body> 
</html> 
Headings are defined with the <h1> to <h6> tags. <h1>defines the largest heading. 
<h6> defines the smallest heading. <h1>This is a heading</h1> 
<h2> This is a heading</h2> 
<h3> This is a heading</h3> 
<h4> This is a heading</h4> 
<h5> This is a heading</h5> 
<h6> This is a heading</h6> 
HTML automatically adds an extra blank line before and after a heading,
15 
Paragraphs 
Paragraphs are defined with the <p> tag. 
<p>This is a paragraph</p> 
<p>This is another paragraph</p> 
HTML automatically adds an extra blank line before and after a paragraph 
Don’t Forget the Closing Tag 
. 
You might have mnoticed that paragraphs can be written without end tags 
</p> : <p>this is a paragraph 
<p>This is another paragraph 
The example above will work in most browsers, but don’t rely on it. Future 
version of HTML will not allow you to skip ANY end tags. 
Closing all HTML elements with an end tag is a future proof way of writing 
HTML. It also makes the code easier to understand (read and browse) when you to mark both 
where an element starts and where it ends. 
Line Breaks 
The <br> tag is used which you want to break a line, but don’t want to start a new 
paragraph. The <br> tag forces a line break wherever you place it. <p> This <br>> is a 
para<br>graph with line breaks</p> 
Try it yourself 
The <br> 
Tag is an empty tag. It has no end tag like </br>, since a closing tag doesn’t make 
any sense. 
<br> or <br/> 
More and more often you will see the <nr> tag written like this: <br/> 
Because the <br>tag has on end tag (or closing tag), it breaks one of he rules for 
future HTML (the XML based XHTML), namely that all elements must be closed. 
Writing it like <br/> is a future proof way of closing <or ending> the tag inside the 
opening tag, accepted by both HTML and XML. 
Comments in HTML
The comment tag is used to insert a comment in the HTML source code. A 
comment will be ignored by the browser. You can use comments to explain your code, which 
can help you when you edit the source code at a later dare. 
16 
<! -- This is a comment-- > 
Note that you need an exclamation point after the opening bracket, but not before 
the closing bracket. 
Recap on HTML Elements 
· Each HTML element has an element mane (body,h1,p,br) 
· The start tag is the name surrounded by angle brackets: <h1> 
· The end tag is a slash and the name surrounded by angle brackets </h1> 
· The element content occurs between the start tag and the end tag 
· Some HTML elements have on content 
· Some HTML elements have no end tag 
Basic Notes – Useful Tips 
When you write HTML text, you can never be sure how the text is displayed in 
another browser. Some people have large computer displays, some have small. The text will be 
reformatted every time the user resizes his window. 
HTML will truncate the spaces in your text. Any number of spaces counts as one. 
Some extra information: In HTML a new line counts as one space. 
Using empty paragraphs <p> to insert blank lines is a bad habit. Use the <br> tag 
instead. (But don’t use the <br> tag to create lists. Wait until you have learned about HTML 
lists.) 
HTML automatically adds an extra blank line before and after some elements, like 
before and after a paragraph, and before and after a heading. 
We use a horizontal rule (the <hr> tag), to separate the sections in out tutorials. 
Basic HTML Tags 
If you lookup the basic HTML tags in the reference below, you will see that the 
reference contains additional information about tag attributes. 
You will learn more about HTML tag attributes in the next chapter of this tutorial. 
Tag Description
17 
<html> Defines an HTML document 
<body> Defines the document’s body 
<h1> to </h6> Defines header 1 to header 6 
<p> Defines a paragraph 
<br> Inserts a single line break 
<hr> Defines a horizontal rule 
<!--> Defines a comment 
Horizontal Rules 
Horizontal rules are used to visually break up sections of a document. The <hr> 
tag creates a line from the current position in the document to the right margin and breaks the 
line accordingly. 
For example, if you were reproducing text from a book, you might want to use 
rules to show a break between chapters, as shown in the following excerpt from Anna Sewell’s 
Black Beauty: 
<! DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” 
http://www.w3.org/TR/html4/strict.dtd> 
<html> 
<head> 
<title> Excerpt of Black Beauty </title> 
</head> 
<body> 
<p>One day he was at this game, and did not know that the master was in the next 
field; but he was there., watching what was going on; over the hedge he jumped in a snap, and 
catching Dick by the arm, he gave him such a box in the ear as made him roar with the pain and 
surprise. As soon as we saw the master we trotted up nearer to see what went on. </p> <p> “Bad 
boy!” he said, “bad boy! To chase the colts. This is not the first time, nor he second, nut it shall 
be the last. 
There—take your money and go home; I shall not want you on my farm again. 
”</p> <p> so we never saw Dick any more. Old Daniel, the men who looked after the horses, 
was just as gentle as our master, so we were well off. </p> <hr> <p>Chapter 02 The Hunt</p> 
<p>Before I was two years old a circumstance happened which I have never forgotten. It was
early in the spring; there had been a little frost in the night, and a light mist still hung over the 
woods and meadows. I and the other colts were feeding at the lower part of the field when we 
heard, quite … </p> 
18 
</body> 
</html> 
As with most tags, you can customize the look of the <hr> tag by using Styles. For 
example, consider the following style: 
<style type=”text/css”> 
Hr {color: red; height: 5px; width: 50%;} 
<style> 
If this style were added to our last example. The results would be similar to the 
output shown in Figure
19 
HTML Attributes 
Attributes provide additional information to an HTML element. 
HTML Tag Attributes 
HTML tags can have attributes. Attributes provide additional information to an 
HTML element. 
Attributes always come in name/ value pairs like this: name =”value”. 
Attributes are always specified in the start tag of an HTML element. 
Attributes Example 1: 
<h1>defines the start of a heading. 
<h1 align= center”> has additional information about the alignment. 
Attributes Example 2: 
<body> defines the body of an HTML document. 
<body bgcolor=”yellow”> has additional information about the background color.
20 
Attributes Example 3: 
<table> defines an HTML table. (You will learn more about HTML tables later) 
<table border+”1”> has additional information about the border around the table 
Use Lowercase Attributes 
Attributes and attribute values are case-insensitive. However, the World Wide 
Web Consortium (W3C) recommends lowercase attributes/attribute values in their HTML 4 
recommendation, and XHTML demands lowercase attributes/attribute values. 
Always Quote Attribute Values 
Attribute values should always be enclosed in quotes. Double style quotes are the 
most common, but single style quotes are also allowed. 
In some rare situations, like when the attribute values itself contains quotes, it is 
necessary to use single quotes: 
name= ‘John “ShotGun” Nelson’ 
HTML Text Formatting 
HTML defines a lot of elements for formatting output’ like bold or italic text. 
Text Formatting Tags 
Tag Description 
<b> Defines bold text 
<big> Defines big text 
<em> Defines emphasized text 
<i> Defines italic text 
<small> Defines small text 
<strong> Defines strong text 
<sub> Defines subscripted text 
<sup> Defines superscripted text 
<ins> Defines inserted text 
<del> Defines deleted text 
<s> Deprecated. Use <del> instead 
<strike> Deprecated. Use <del> instead 
<u> Deprecated. Use styles instead
21 
“Computer Output” Tags 
Tag Description 
<code> Defines computer code text 
<kbd> Defines keyboard text 
<samp> Defines sample computer cods 
<tt> Defines teletype text 
<var> Defines a variable 
<pre> Defines preformatted text 
<listing> Deprecated. Use <pre> instead 
<plaintext> Deprecated. Use <pre> instead 
<xmp> Deprecated. Use <pre> instead 
Citations, Quotations, and Definition Tags 
Tag Description 
<abbr> Defines an abbreviation 
<acronym> Defines an acronym 
<address> Defines an address element 
<bdo> Defines the text direction 
<blockquote> Defines a long quotation 
<q> Defines a short quotation 
<cite> Defines a citation 
<dfn> Defines a definition term 
Inserting texts, Images 
HTML can also specify certain formatting to be applied to the text content of the 
web page. 
· Font formatting 
Font Face: Default, Arial, Courier, Time New Roman. 
Size: -3,-2,-1, default, +1, +2, +3 
Colour: Default, Black, Red, Green, Blue 
Style formatting: 
Bold 
Italic 
Strong 
Emphasis 
Code
The text formatting effects used above can be combined, as shown in the 
22 
following example: 
Text formatting effects can be combined by using nested HTML tags 
Text can also be formatted to become a hypertext link to another web page, 
document or resource. This is described on the following page. 
For images, HTML can be used to specify the image file to be included, the size 
(in pixels) at which the image should be displayed by the browser and how the image should be 
‘wrapped’ around the surrounding text. In addition, images can be made into hyperlinks to other 
internet resources. 
A text alternative that will be displayed if the image fails to load should also be 
provided. 
How to View HTML Source 
Have you ever seen a Web page and wondered “Hey! How did they do that?” 
To find out, click the VIEW option in your browser’s toolbar and select SOUTCE 
to PAGE SOURCE. This will open a window that shows you the HTML code of the page.
23 
HTML Entities and Links 
Chapter 
HTML Character Entities 
Some characters like the < character, have a special meaning in HTML, and therefore 
cannot be used in the text. 
To display a les than sign (<) in HTML, we have to use a character entity. 
Character Entities 
Some characters have a special meaning in HTML, like the less than sign (<) that 
defines the start of an HTML tag. If we want the browser to actually display these characters we 
must insert character entities in the HTML source. 
A character entity has three parts: an ampersand (&), an entity name or# and an entity 
number, and finally a semicolon (;). 
To display a less than sign in an HTML document we must write: &it; or &#60; 
The advantage; of using a name instead of a number is that a name is easier to; 
remember. The disadvantage is that not all browsers support the newest entity names, while the 
support for entity numbers is very good in almost all browsers. 
Note that the entities are case sensitive. 
Non-breaking space 
The most common character entity in HTML is the non-breaking space. 
Normally HTML will truncate spaces in your text. If you write 10 spaces in your text 
HTML will remove 9 of them. To add spaces to your text, use the &nbsp; character entity. 
The Most Common Character Entities: 
3
Result Description Entity Name Entity Number 
24 
Non-breaking 
space 
&nbsp; &#160; 
< less than &it; &#60; 
> Greater than &gt; &#62 
& Ampersand &amp; &#38; 
“ Quotation mark &quot; &#34; 
‘ Apostrophe &apos;(does 
Not work in IE) 
&#39; 
Some Other Commonly Used Character Entities: 
Result Description Entity Name Entity Number 
¢ Cent &Cent &#160; 
£ Pound &Pound &#163; 
¥ Yen &Yen &#165; 
€ Euro &Euro &#8364; 
§ Section &Section &#167; 
© Copyright &Copyright &#169 
® Registered 
Trademark 
&Registered 
Trademark 
&#174; 
× Multiplication &Multiplication &#215 
÷ division &Division &#247 
Some Other Commonly Used Character Entities: 
Result Description Entity Name Entity Number 
¢ Cent &Cent &#160; 
£ Pound &Pound &#163; 
¥ Yen &Yen &#165; 
€ Euro &Euro &#8364; 
§ Section &Section &#167; 
© Copyright &Copyright &#169 
® Registered 
Trademark 
&Registered 
Trademark 
&#174; 
× Multiplication &Multiplication &#215 
÷ division &Division &#247 
HTML Links
25 
HTML uses a hyperlink to link to another document on the web. 
Hyperlinks are what make using the web so easy. By using HTML tags to embed the 
instructions on where other resources are located on the internet and how to access them, resources 
can be retrieved from anywhere on the internet by simply clicking on a link. 
Although HTML was initially developed as a hypertext system, in which the 
instructions were embedded within the text of a web page, hyperlinks can now be embedded within 
forms of media, including images, videos and animation. 
The Anchor Tag and the Href Attribute 
HTML uses the <a> (anchor) tag to create a link to another document. 
An anchor can point to any resource on the web: an HTML page, an image, a sound 
file, a movie, etc. 
The syntax of creating an anchor: 
<a href=”url”> Text to be displayed</a> 
The <a> tag is used to create an anchor to link from, the href attribute is used to 
address the document to link to, and the words between the open and close of the anchor tab will be 
displayed as a hyperlink. 
This anchor defines a link to Rgcsm: 
<a href=http://www.rgcsm.org/”> Visit RGCSM!</a> 
The line above will look like this in a browser. 
Visit RGCSM 
The Target Attribute 
With the target attribute, you can define where the linked document will be opened. 
The line below will open the document in a new browser window : <a 
href=http://www.rgcsm.org/ “ 
target =”_blank”>Visit Rgcsm! </a> 
The Anchor Tag and the Name Attribute 
The name attribute is used to create a named anchor. When using named anchors we 
can create links that can jump directly into a specific section on a page, instead of letting the user 
scroll around to find what he/she is looking for,
Below is the syntax of a named anchor: <a mane=”label”> Text to be displayed </a> 
The name attribute is used to create a named anchor. The name of the anchor can be 
26 
any text you care to use. 
You should notice that a named anchor is not displayed in a special way. 
To link directly to the “tips” section, add a # sign and the name of the anchor to the 
end of a URL. Like this: <a href=”http://www.rgcsm.org/html _links.asp#tips”> 
Jump to the Useful Tips Section</a> 
A hyperlink to the Useful Tips Section from WITHIN the file “htnl_links.asp” will 
look like this: <a href=”#tips”> Jump to the Useful Tips Section </a> 
Basic Notes – Useful Tips 
Always add a trailing slash to subfolder references. Of you link like this: href 
=”http://www.rgcsm.org/html”, you will generate two HTTP requests to the serve, because the 
server will add a slash to the address and create a new request like this: 
href=”http:www.rgcsm.org/html/”, 
Named anchors are often used to create “table of contents” at the beginning of a large 
document. Each chapter within the document is given a named anchor, and links to each of these 
anchors are put at the top of the document. 
If a browser cannot find a named anchor that has been specified, it goes to the top of 
the document. No error occurs.
27 
HTML Frames, Tables and List 
Chapter 
4 
HTML Frames 
With frames, you can display more than one Web page in the same browser window. 
The intelligent use of frames can give your pages a cleaner look and make them easier to navigate. 
Dividing a page into frames is actually quite simple. The basic concept goes like this: Each frame is 
a regular, complete html document. If you wanted to divide your page into 2 side by side frames, 
then you would put one complete html document in the left frame and another complete html 
document in the right frame, in addition you need to write a third html document. This MASTER 
PAGE (I’m coining a new phrase here folks ) contains the <FRAMS> tags that specify what goes 
where. As a matter of fact, that’s its only function. 
Frames 
With frames, you can display more than one HTML document in the same browser 
window. Each HTML document is called a frame, and each frame is independent of the others. 
The disadvantages of using frames are: 
· The web developer must keep track of more HTML documents. 
· It is difficult to print the entire page. 
The Frameset Tag 
· The <frameset> tag defines how to divide the window into frames 
· Each frameset defines a set of rows or columns 
· The values of the rows/columns indicate the amount of screen area each 
row/column will occupy. 
The Frametag 
The <frame> tag defines what HTML document to put into each frame
In the example below we have a frameset with two columns. The first column is set to 
25% of the width of the browser window. The second column is set to 75% of the width of the 
browser window. The HTML document “frame_a.htm” is put into the first column, and the HTML 
document “frame_b.htm” is put into the second column: 
Tag Description 
<frameset> Defines a set frames 
<frame> Defines a sub window (a frame) 
<noframes> Defines a noframe section for browsers 
28 
<frameset cols=”25%,75%”> 
<frame src=”frame_a.htm”> 
<frame src=”frame_b.htm”> 
</frameset> 
Note: The frameset column size value can also be set in pixels (cols=”200,500”), and 
one of the columns can be set to use the remaining space (cols=”25%,*”) 
Basic Notes – Useful Tips 
If a frame has visible borders, the user can resize it by dragging the border. To prevent 
a user from doing this, you can add noresize=”noresize” to the <frame> tag. 
Add the <noframes> tag for browsers that do not support frames. 
that do not handle frames 
<iframe> Defines an inline sub window (frame) 
Important: You cannot use the <body></body> tags together with the <frameset> 
</frameset> tags! However, if you add a <noframes> tag containing some text for browsers that do 
not support frames, you will have to enclose the text in <body></body> tags! See how it is done in 
the first example below. 
Frame Tags 
First things first. For this tutorial we will need a few html documents. Fire up Notepad 
and copy the following to get you started. 
<HTML> 
<HEAD> 
<TITLE>My Frame Page</TITLE> 
</HEAD>
29 
<BODY> 
</BODY> 
</HTML> 
We will give each document a name. In Table Tutor and Form Tutor we used guy’s 
names. I think its time to get some young ladies in here. 
<HTML> 
<HEAD> 
<TITLE>My Frame Page </TITLE> 
</HEAD> 
<BODY> 
Lisa 
</BODY> 
</HTML> 
Create a new folder somewhere and save this as lisa.html. 
Now make another html document. 
<HTML> 
<HEAD> 
<TITLE> My Frame Page</TITLE> 
</HEAD> 
<BODY> 
Terri 
</BODY> 
</HTML> 
Save this in the same folder as terri.html. 
Now do the same for Kim, Tina, Shannon, and Beth. Save them just like the others. 
You should now have a folder that contains 6 complete standalone html documents. 
Ok, now the fun stuff…making your master page. Start with this. 
<HTML> 
<HEAD> 
<TITLE> My Frame Page-The Master Page</TITLE> 
</HEAD> 
<BODY> 
</BODY> 
</HTML> 
Remove the </BODY> tags. The master page doesn’t use them……
30 
<HTML> 
<HEAD> 
<TITLE>My Frame Page-The Master Page</TITLE> 
</HEAD> 
</HRML> 
…..it uses <FRAMEST> tags instead. 
<HTML> 
<HEAD> 
<TITLE>My Frame Page-The Master Page</TITLE> 
</HEAD> 
<FRAMESET> 
</FRAMESET> 
</HTML> 
To keep things a little cleaner, I’m going to stop0 writing the <HTML>, <HEAD> 
and <TITLE> tags. Needless to say, keep them in your document. 
<FRAMESET> 
</FRAMESET> 
Now’s a good time to save it. Save it in your folder (with all the girls) as index.html. 
If you try to open it with your browser now it will be blank. All you have said so far is “This is my 
Master Page”. 
Now let’s start defining just how things are going to look. Tell the browser to split the 
main window into 2 columns, each occupying 5% of the window. 
<FRAMESET COLS=”50%, 50%”> 
</FRAMESET> 
This will still be blank, we have one more thing to do before our ‘system is 
operational”. 
We must tell the browser what to put in each frame. 
<FRAMESETS COLS=”50%,50%”> 
<FRAME SCR=”lisa.html”> 
<FRAME SRC=”terri.html”> 
</FRAMESET>
31 
You are now the proud parent of a fully functional Framed page! 
One last thing before we go on. Note that <FRAMESET> is a container tag, and 
<FRAME>is not. For those that don’t know what that means, a container tag has an opening 
<TAG> and a closing </TAG>. 
With the form tag you can add to your web pages a guestbook, order forms, surveys, 
get feedback or whatever. 
The basic construction of a html from is this………… 
<FROM> begin a form 
<INPIT> ask for information in one of several different ways... 
<INPUT> …there can be as many input areas as you wish 
</FORM> end a form 
That’s html forms in a nutshell. You are now ready to make some forms! Now’s a 
good time to stress that if you want to learn how to make quality html documents, them you would be 
well served to take the time to teach yourself the tags. If you rely on the so-called “from wizards” in 
the “easy as pie html editors” out there, you will have greatly limited flexibility, and the end result 
may not be what you are trying to achieve. In my opinion the best html editors to use are text based 
editors. A few good ones that come to mind are listed here. These editors will make your html coding 
easier. They don’t attempt to do it for you. 
Just like “follow the bouncing ball”, I want you to open up Notepad (Yes, Notepad!) 
and follow me. Copy and paste off this page the following to get you started: 
<HTML> 
<HEAD> 
<TITLE> Joe’s the handsomest guy I know </TITLE> 
</HEAD> 
</BODY> 
<FORM> 
</FROM> 
</BODY> 
</HTML> 
Next we must tell the browser where to send the data we gather and how to send it. 
There are two basic things you can do. 1) You can send the data to a CGI script for processing. The 
parsed data is then emailed to you. This is the preferred method, or 2) You can have the data emailed 
directly to you using the mailto action. This is simpler but less reliable. 
For the sake of simplicity, we will start with the second method. 
<HTML>
<HEAD> 
<TITLE> Joe’s the handsomest guy I know </TITLE> 
</HEAD> 
<BODY> 
<FROM METHOD= POST ACTION=”mailto: xxx@xxx.xxx” 
32 
ENCTYPE=”text/plain”> 
</FROM> 
</BODY> 
</HTML> 
The only thing you have to do is plug in your email address after mailto: 
To send the data to more than one email address, separate them with commas… 
larry@3stooges.org,curly@3stooges.org,mo@3stooges.org 
Now, I said that this method is simple, but not entirely reliable. For the time being, it 
is perfectly OK to use this method as you work through the tutorial. As you complete the lessons 
you can practice sending yourself information. For most people, under most circumstances, 
everything will be just fine. If you’d like, you can skip the rest of this lesson for now and dive right 
into making forms. After you learn a little about forms (or if you’re having trouble submitting 
them), definitely come back here and learn more about form processing. 
Every so often, depending on the sender’s browser/email configuration, using the 
mailto action might just bring up an empty New Mail window instead of sending the form data. 
Sometimes (rarely) you’ll click on the button and nothing will happen. in this case you will not be 
able to even practice with the simpler mailto action. You will have to straight into using a CGI form 
handler to practice with. 
Before we into that, there is one more thing about the mailto action that I want to 
mention. Sometimes, depending on the person sending the data, you will receive the data in a very 
strange format. Instead of something nice & neat like this…….. 
FORMNAME=New Entrant 
NAME=R.U. Havinfun 
ADDRESS=13`3 Mockingbird Lane 
CITY=Beverly Hills 
STATE=CA 
The info comes back looking like this….. 
FROMNAME=New+Entrant&NAME=R.U. +Havinfun&ADDRESS=1313 
+Mockingbird+Lane&CTTY+Beverly+Hills&STATE=CA 
HTML Tables 
With HTML you can create tables.
33 
Tables 
Tables are defined with the <table>tag. A table is divided into rows (with the <tr> 
tag), and each row is divided into data cells (with the <td> tag). The letters td stands for “table 
data,” which is the content of a data cell. A data cell can contain text, images, lists, paragraphs, 
forms, horizontal rules, tables, etc 
<table border=”1”> 
<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> 
How it looks in a browser: 
row 1, cell 1 row 1, cell 2 
row 1, cell 2 row 2, cell 2 
Tables and the Border Attribute 
If you do not specify a border attribute the table will be displayed without any border 
sometimes this can be useful, but most of the time, you want the borders to show. 
To display a table with borders, you will have to use the border attribute :< table 
border=”1”> 
<TR> 
<td>Row 1, cell 1</td> 
<td>Row 2, cell 2</td> 
</tr> 
</table> 
Headings in a table 
Headings in table are defined with the <th> tag. 
<table border=”1”>
34 
<tr> 
<th>Heading</th> 
<th>Another Heading</th> 
</tr> 
<tr> 
<td>row 1, cell 1</td> 
<td> row 1, cell 2</td> 
</tr> 
<tr> 
<td>row 2, cell 1</td> 
<td>row 2, cell 2</td> 
</tr> 
</table> 
How it looks in a browser 
Heading Another Heading 
row 1, cell 1 row 1, cell 1 
row 1, cell 2 row 1, cell 2 
Empty Cells in a Table 
Table cells with no content are not displayed very well in most browsers.<table 
border=”1” 
<tr> 
<td>row 1, cell 1</td> 
<td> row 1, cell 2</td> 
</tr> 
<tr> 
<td>row 2, cell 1</td> 
<td></td> 
</tr> 
</table> 
How it looks in a browser: 
row 1, cell 1 row 1, cell 2 
row 2, cell 1
Note that the borders around the empty table cell are missing (NB! Mozilla Firefox 
35 
displays the border). 
To avoid this, add a non-breaking space (&nbsp;) to empty data cells, to make the 
borders visible: 
<table border=”1”> 
<tr> 
<td>row 1, cell 1</td> 
<td> row 1, cell 2</td> 
</tr> 
<tr> 
<td>row 2, cell 1</td> 
<td> &nbsp ;< /td> 
</tr> 
</table> 
How it looks in a browser: 
row 1, cell 1 row 1, cell 2 
row 2, cell 1 
Basic Notes – Useful Tips 
The <thead>, <tbody> and <tfoot> elements are seldom used, because of bad browser 
support. Expect this to change in future versions of XHTML. 
Table Tags 
Tag description 
<table> Defines a table 
<th> Defines a table header 
<tr> Defines a table row 
<td> Defines a table cell 
<caption> Defines a table caption 
<colgroup> Defines groups of table column 
<col> Defines the attribute values for 
one or more columns in a table 
<thead> Defines a table head 
<tbody> Defines a table body
36 
<tfoot> Defines a table footer 
HTML Lists 
HTML supports ordered, unordered and definition lists. 
Unordered Lists 
An unordered list is a list of items. The list items are marked with bullets (typically 
small black circles). 
An unordered list starts with the <ul> tag. Each list item starts with the <li> tag. 
<ul> 
<li>Coffee</li> 
<li>Milk</li> 
M/ul> 
Here is how it looks in a browser: 
· Coffee 
· Milk 
Inside a list item you can put paragraphs, line breaks, images, links, other lists, and. 
example: 
<html> 
<head> 
<title>Example Unordered List with Image Bullets</title> 
</head> 
<body> 
<p> <b>sphere</b></p> 
<ul style=”list-style-image: url<sphere.jpg);”> 
<li>Vanilla<l/i> 
<li>Chocolate</li> 
<li>Strawberry</li> 
</ul> 
<p> <b>cone</b></p> 
<ul style=”list-style-image: url<cone.jpg);”> 
<li>Vanilla<l/i> 
<li>Chocolate</li> 
<li>Strawberry</li> 
</ul> 
</body> 
</html>
37 
Ordered Lists 
An ordered list is also a list of items. The list items are marked with numbers. 
An ordered list starts with the <ol> tag. Each list item starts with the <li> tag. 
<ol> 
<li>Coffee<li> 
<li>Milk</li> 
</ol> 
Here is how it looks in a browser: 
1. Coffee 
2. Milk 
Inside a list item you can put paragraphs, line breaks, images, links, other lists, etc. 
Definition Lists 
A definition list is not a list of items. This is a list of terms and explanation of the 
terms. 
A definition list starts with the <dl>tag. Each definition- list term starts with the 
<dt>tag. Each definition-list definition starts with the <dd> tag. 
<dl>
38 
<dt>Coffee</dt> 
<dd>Black hot drink</d> 
<dt>Milk</dt> 
<dd>White cold drink</dd> 
</dl> 
Here is how it looks in a browser: 
Coffee 
Black hot drink 
Milk 
White cold drink 
Inside a definition-list definition (the<dd>tag) you can put paragraphs, line breaks, 
images, links, other lists, etc. 
List Tags 
Tag Description 
<ol> Defines an ordered lilt 
<ul> Defines an unordered list 
<li> Defines a list item 
<dl> Defines a definition list 
<dt> Defines a definition term 
<dd> Defines a definition description 
<dir> Deprecated. Use <ul> instead 
<menu> Deprecated. Use <ul> instead 
Examples of Lists: 
<HTML> 
<HEAD><TITLE>Lists</TITLE><HEAD> 
<BODY> 
// <B>Example on Unordered List</B> // 
<UL TYPE=FILLROUND> 
<LI>Sportstar 
<LI>Business Week 
<LI>Time 
</UL> 
// <B>Example on Ordered List</B> // 
<OL TYPE=”I”START=4>
39 
<LI>Sportstar 
<LI>Business Week 
<LI>Time 
</OL> 
// <B>Example on Definition List</B> // 
<DL> 
<DT>Sports Magazine<DD>Sportstar 
<DT>Business Magazine<DD>Business Week 
<DT>General Magazine<DD>Time 
</DL> 
</BODY> 
</HTML> 
Nested Lists 
You can nest lists of the same or different types. For example, suppose you have a 
bulleted list and need a numbered list beneath one of the items, as shown: 
? Send us a letter detailing the problem. But sure to include the following: 
1. Your name 
2. Your order number 
3. Your contact information 
4. A detailed description of the problem 
In such a case, you would nest an ordered list inside an unordered one, as shown in 
the following code: 
<!DOCTYPE HTML PUBLIC “_//W3C//DTD HTML 4.01//EN” 
http://www.w3.org/TR/html4/strict.dtd”> 
<html> 
<head> 
<title>Example Definition List </title> 
</head> 
<body> 
<ul style=”list-style: disc ;”> 
<li>Send us a letter detailing the problem. Be sure to 
Include the following :< /li> 
<ol style=”list-style: decimal ;”> <li>Your name.</li> 
<li>Your order number. </li> 
<li>Your contact information. </li>
40 
<li>A detailed description of the problem.</li> 
</ol> 
</ul> 
</body> 
</html> 
The output of the code is shown in Figure 
Figure: you can nest different types of lists within one another. 
Note that the nested list does not span any open or close tags-it starts after the close 
tag of the parent’s item and before any other tags in the parent list. It is also formatted (indented) to 
make it easier to identify in the code. Using this method, you can nest any list within any other list. 
Changing the Start Value of Ordered Lists 
Previous versions of HTML allowed the use of the start attribute in the <ol> tag to 
control what number or letter the list began with. For example, the following code starts a list with 
the decimal number 12: 
<ol start=”12” style=”list-style: decimal ;”> 
However, the start attribute of the <ol> tag was deprecated, and a replacement CSS 
style has yet to be defined. Although you can use the start attribute, your document will no longer 
validate against strict HTML.
If you find yourself needing consistent, yet flexible numbering, consider using the 
new CSS2 automatic counters and numbering feature. This feature user the content property along 
with the new counter-increment and counter-reset properties to provide a flexible yet powerful 
automatic counter function. 
The following style code will define a counter and cause any <ol> list to begin with 
41 
an item number of 12: 
<style type=”text/css”> 
ol {counter-reset: list 11 :} 
li {list-style-type: none ;} 
li: before { 
Content: counter (list, decimal)”.”; 
counter-increment: list ;} 
</style> 
This code introduces quite a few CSS2 concepts-pseudo-elements, counters, and 
relates properties and methods. However, it isn’t as complex as it might first appear:? 
· The ol definition causes the counter (list) to be reset to 11 every time the <ol> tag 
is use-that is, at the beginning of every ordered list? 
· The li definition sets the list style type to none-the counter will display our 
number, if we left the list style type set to decimal, there would be an additional number with each 
item.? 
· The li: before definition does two things: 1) causes the counter to be displayed 
before the item (using the begin pseudo-element and the content property) along with a period and a 
space; 2) increments the counter. Note that the counter increment happens first, before the display. 
That is the reason you need to reset the counter to one lower than your desired start. 
Using the preceding styles along with the following list code in a document results in 
a list with items numbered 12-15: 
<ol> 
<li>item 12</li> 
<li>item 12</li> 
<li>item 12</li> 
<li>item 12</li> 
</ol> 
Counters are a new, powerful feature of CSS2.Unfortunately, at the time of this 
writing, only the Opera browser fully supports counters. However, the other browsers are sure to 
follow suit. You’ll find more information on counters and the content property in chapter 16. Tip
The various list properties can all be defined without one property, list-style. The list-style property 
has the following syntax: 
42 
list-style: <list-style-type> <list-style-image> 
<list-style-position> 
You can use this one property to specify one, two, or all three list-style properties in 
one declaration. For example, to define an ordered list with lowercase letters and inside positioning, 
you could use the following tag: 
<ol style=”list-style: lower-alpha inside ;”> 
See Chapters 16 and 17 for more information on styles.
43 
HTML Forms and Input 
Chapter 
HTML Forms are used to select different kinds of user input. 
Forms 
A form is an area that can contain form elements. 
Form elements are elements that allow the user to enter information (like text fields, 
text area fields, drop-down menus, radio buttons, checkboxes, etc.) in a form. 
A form is defined with the <form> tag. 
<form> 
<input> 
<input> 
</form> 
Input 
The most used form tag is the <input> tag. The type of input is specified with the type 
attribute. The most commonly used input typed is explained below. 
Text Fields 
Text fields ate used when you want the user to type letters, numbers, etc. in a form. 
<form> 
First name: 
<input type=”text” name=”firstname> 
<br> 
Last name:] 
<input type=”text” name=”lastname”> 
</form> 
How it looks in a browser: 
5
44 
First name: 
Last name: 
Note that the form itself is not visible. 
Also note that in most browsers, the width of the text field is 20 characters by default. 
Radio Buttons 
Radio Buttons are used when you want the user to select one of a limited number of 
choices. 
<form> 
<input type=”radio” name=”sex” value=”male”> Male 
<br> 
<input type=”radio” name=”sex” value=”female”> Female 
</from> 
How it looks in a browser: 
Male 
Female 
Note that only one option can be chosen. 
Checkboxes 
Checkboxes are used when you want the user to select one or more options of a 
limited number of choices. 
<form> 
I have a bike: 
<input type=”checkbox” name=”vehicle” value=”Bike”> 
<br> 
I have a car: 
<input type=”checkbox” name=”vehicle” value=”Car”> 
<br> 
I have an airplane: 
<input type=”checkbox” name=”vehicle” value=”Airplane”> 
</from> 
How it looks in a browser: 
I have a bike:
45 
I have a car: 
I have an airplane: 
The form’s Action Attribute and the Submit Button 
When the user clicks on the “Submit” button, the content of the form is sent to 
another file. The form’s action attribute defines the name of the file to send the content to. The file 
defined in the action attribute usually does something with the received input. 
<form name =”input” action=”html_form_action.asp” 
method=”get”> 
username: 
<input type=”text” name=”user”> 
<input type=”submit” value=”submit”> 
</form> 
How it looks in a browser 
Username: 
submit 
If you type some characters in the text field above, and click the “submit” button, you 
will send your input to a page called “html_form_action.asp”. The page will show you the received 
input . 
Form Tags 
Tag Description 
<form> Defines a form for user input 
<input> Defines an input field 
<textarea> Defines a text-area (a multi 
Line text input control) 
<label> Defines a label to a control 
<fieldset> Defines a fieldset 
<legend> Defines a caption for a field 
Set 
<select> Defines a selectable list (a
46 
Drop-down box) 
<optgroup> Defines an option group 
<option> Defines an option in the drop-down 
box 
<button> Defines a push button 
<isindex> Deprecated. Use <input> 
instead
HTML Images and Colors 
47 
Chapter 
HTML Images 
With HTML you can display images in a document. 
The Image Tag and the Src Attribute 
In HTML, images are defined with the <img> tag. 
The <img> tag is empty, which means that it contains attributes only and it has no 
closing tag. 
To display an image on a page, you need to use src attribute. Src stands for “source”. 
The value of the sre attribute is the URL of the image you want to display on your page. 
The syntax of defining an image: 
<img src=”url”> 
The URL points to the location where the image is stored. An image named “boat.gif” 
located in the directory “images” on www.rgcsm.org” has the URL 
:http://www.rgcsm.org/images/boat.gif. 
The browser puts the image where the image tag occurs in the document. If you put an 
image tag between two paragraphs, the browser shows the first paragraph, then the image, and then 
the second paragraph. 
Example: 
<HTML> 
<HEAD><TITLE> Working with Images </TITLE></HEAD><BODY 
Background=”images/textural.gif “> 
<B>Controlling Image Borders! </B><CENTER> 
<I>Image without a BORDER </I><BR><BR> 
<IMG Src = “images/corp.gif”><BR><BR> 
<I> Image With BORDER =3</I><BR><BR> 
6
48 
<IMG Border=3 src=”images/corp./gif”><BR> 
</CENTER> 
</BODY> 
</HTML> 
The Alt Attribute 
The alt attribute is used to define an “alternate text” for am image. The value of the alt 
attribute is an author-defined text: <img src=”boat.gif” alt=”Big Boat”> 
The “alt” attribute tells the reader what he or she is missing on a page if the browser 
can’t load images. The browser will then display the alternate text instead of the image. It is a good 
practice to include the “alt” attribute for each image on a page, to improve the display and usefulness 
of you document for people who have text-only browsers. 
Example: 
<HTML> 
<HEAD><TITLE> Working with Images </TITLE></HEAD> 
<BODY Background=”images/textural.gif”> 
<B> Use of ALT attribute</B><BR><CENTER> 
<I>Available Image: javacup.gif</I><BR><BR> 
<IMG Src=”images/javacup.gif”><BR><BR> 
<I>Unavailable Image: javac.gif - Without the ALT Attribute 
</I><BR><BR> 
<IMG>Src=”images/javac.gif”><BR><BR> 
<I>Unavailable Image: javac.gif – With the ALT Attribute set to 
“Java”</I><BR><BR> 
<IMG Alt=”The Java Cup” Src=”images/javac.gif”><BR> 
</CENTER> 
</BODY> 
</HTML> 
Basic Notes – Useful Tips 
If an HTML file contains ten images – eleven file are required to display the page right. 
Loading images take time, so my best advice is: Use images carefully. 
Image Tags
49 
Tag Description. 
<img> Defines an image 
<map> Defines an image map 
<area> Defines a clickable area inside 
an image map 
Example: Controlling image size: 
<HTML> 
<HEAD><TITLE> Working with Images </TITLE> </HEAD> 
<BODY Background =”images/textural.gif”> 
<B>Controlling Image Sizes! </B><CENTER> 
<I>Normal Image Size</I><BR><BR> 
<IMG Src=”images/computer.gif”>BR> 
<I>Image With Size <Height And Width) Set To200</I><BR><BR> 
<IMG Height =200 Src=”images/computer.gif Width=200><BR> 
</CENTER> 
</BODY> 
</HTML> 
Example: 
Setting image alignment 
<HTML> 
<HEAD><TITLE>Working with Image </TITLE> </HEAD> 
<BODY Background=”images/textural.gif”> 
<B><I> Image Aligned Left </I></B> 
<IMG Align=Left Src=”images/sctonly2.gif”><BR><BR> Silicon Chip 
Technologies, <BR> 
<I> We Specialize In Corporate Training, Software Development and Placements. Our 
Training Program and Software Development include Web Based Commercial Applications and 
Commercial Application Development using Database. </I> <BR> <BR> <BR> <BR> 
<B><I> Image Aligned Right </I></B> 
<IMG Align=Right Src=”images/sctonly2.gif”><BR><BR> Silicon 
Chip Technologies, <BR>
<I> We Specialize In Corporate Training, Software Development And Placements. Our 
Training Program and Software Development include Web Based Commercial Applications and 
Commercial Application Development using Database. </I> 
50 
</BODY> 
</HTML> 
HTML Background 
A good background can make a Web site look really great. 
Backgrounds 
The <body>tag has two attributes where you can specify background. The background 
can be a color or an image. 
Bgcolor 
<HTML> 
<HEAD><TITLE>Working with Image </TITLE> </HEAD> 
<BODY Background=”images/textural.gif”> 
<B><I> Image Aligned Left </I></B> 
<IMG Align=Left Src=”images/sctonly2.gif”><BR><BR> Silicon Chip 
Technologies, <BR> 
<I> We Specialize In Corporate Training, Software Development And Placements. Our 
Training Program and Software Development include Web Based Commercial Applications and 
Commercial Application Development using Database. </I> <BR> <BR> <BR> <BR> 
<B><I> Image Aligned Right </I></B> 
<IMG Align=Right Src=”images/sctonly2.gif”><BR><BR> Silicon 
Chip Technologies, <BR> 
<I> We Specialize In Corporate Training, Software Development And Placements. Our 
Training Program and Software Development include Web Based Commercial Applications and 
Commercial Application Development using Database. </I> 
</BODY> 
</HTML>The value of this attribute can be a hexadecimal number, an 
RGB value, or a color name:
51 
<body bgcolor=”#000000”> 
<body bgcolor=”rgb(0.0.0)”> 
<body bgcolor=”black”> 
The lines above all set the background-color to black. 
Background 
The background attribute specifies 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 until it fills the entire browser window. 
<body background=”clouds. gif”> 
<body background=http://www.rgcsm.org/clouds.gif”> 
The URL can be relative (as in the first line above) or absolute (as in the second line 
above). 
Note: If you want to use a background image, you should keep 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? 
Basic Notes – Useful Tips 
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). 
HTML Colors 
Colors are displayed combining RED, GREEN, and BLUE light sources. 
Color Values
HTML colors can be defined as a hexadecimal notation for the combination of Red, 
52 
Green, and Blue color values (RGB) 
The lowest value that can be given to one light source is 0 (hex#00) and the highest 
value is 255 (hex#FF). 
The table below shows the result of combining Red, Green, and Blue light sources 
W3C 
Color Color HEX Color RGB 
Standard Color Names 
#000000 rgb(0,0,0) 
#FF0000 rgb(,2550,0) 
#00FF00 rgb(0,255,0) 
#000FF0 rgb(0,0,255) 
#FFFF00 rgb(255,255,0) 
#00FFFF rgb(0,255,255) 
#FF00FF rgb(255,0,255) 
#COCOC0 rgb(192,192,192) 
#FFFFFF rgb(255,255,255) 
W3C has listed 16 color names that will validate with an HTML valuator. 
The color manes are: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, 
purple, red, silver, teal, white, and yellow. 
Cross-browser Color Values 
Some years ago, when most computers only supported 256 different colors, a list of 216 
Web Safe Colors was suggested as a Web standard. The reason for this was that the Microsoft and 
Mac operating system used 40 different “reserved” fixed system colors (about 20 each). 
We are not sure how important this is now, since most computers today have the ability 
to display millions of different colors, but the choice is left to you. 
HTML Color Values 
Colors are displayed combining RED, GREEN, and BLUE light sources.
53 
Color Values 
HTML colors are defined using a hexadecimal notation for the combination of RED, 
GREEN, and BLUE color values (RGB). The lowest value that can be given to one of the light 
sources is 0 (hex#00). The highest value is 255 (hex#FF). 
Turn Off the Red 
If you turn off the Red light completely, there are 65536 different combinations of 
Green and Blue (256*256) to experiment with. 
Click here to see some of these combinations of Green and Blue. 
Turn On the Red 
By setting the Red light completely, there are 65536 different combinations of Green 
and Blue (256*256) to experiment with. 
Click here to see some of these combinations of Green and Blue. 
16 Million Different Colors 
The combination of Red, Green, and Blue values from 0 to 255 gives a total of core 
than 16 million different colors to play with (256*256*256). 
Most modern monitors are capable of display at least 16384 different colors.
54 
HTML Layout fonts and Style 
Chapter 
7 
HTML Layout 
Everywhere on the Web you will find pages that are formatted like newspaper 
pages using HTML columns. 
HTML Layout – Using Tables 
One very common practice with HTML is to use HTML tables to format the 
layout of an HTML page. 
An HTML <table> is used to divide a part of Web page into two columns. 
The trick is to use a table without borders, and may be a little extra cell- padding. 
No matter how much text you add to page, it will stay inside its column borders. 
Example: Creating Table 
<HTML> 
<HEAD><TITLE>Table Attributes </TITLE> </HEAD> 
<BODY BGColor=LIGHTGREY> 
<B>Specifying the BORDER and WIDTH of the Table! 
</B><BR><BR><BR><BR> 
<CENTER><TABLE Borer=5 Width=50%> 
<CAPTION Align=Bottom><B>Personal Information </B> </CAPTION> 
<TR><TH>NAME</TH><TH>AGE</TH></TR> 
<TR Align=CENTER><TD>Shilpa</TD><TD>21</TD> </TR> 
<TR Align=CENTER><TD>Vaishali</TD><TD>22</TD> </TR> 
</TABLE><.CENTER> 
</BODY> 
</HTML>
55 
HTML Fonts 
The <font> tag in HTML is deprecated. It is supposed to be removed in a future 
version of HTML. 
Even if a lot of people are using it, you should try to avoid it, and use styles 
instead. 
The HTML <font> Tag 
With HTML code like this, you can specify both the size and the type of the 
browser output 
<p> 
<font size=2”face=”Verdana”> 
This is a paragraph. 
</font> 
</p> 
<p> 
<font size=”3”face=”Times”> 
This is another paragraph. 
</font> 
<p> 
Font Attributes 
Attribute Example Purpose 
size=”number” size=”2” Defines the font size 
size=”+number” size=”=1” Increases the font size 
size=”-number” size=”-1” Decreases the font size 
face=”face-name” face=”Times” Defines the font-name 
color=”color-value” color=”#eeff00” Defines the font color 
color=”color-name” color=”red” Defines the font color 
The <font> Tag Should NOT be Used 
The <font> tag is deprecated in the latest versions of HTML (HTML 4 and 
XHTML).
The World Wide Web Consortium (w3c) has removed the <font> tag from its 
recommend-dations. In future versions of HTML, style sheets (CSS) will be used to define the 
layout and display properties of HTML elements. 
HTML Styles 
With HTML 4.0 all formatting can be moved out of the HTML document and into 
56 
a separate style sheet. 
How to Use Styles 
When a browser reads a style sheet, it will format the document according to it. 
There are three ways of inserting a style sheet: 
External Style Sheet: 
An external style sheet is ideal when the style is applied to many pages. With an 
external style sheet, you can change the look to an entire Web site by changing one file. Each 
page must link to the style sheet using the <link> tag. The <link> tag goes inside the head 
section. 
<head> 
<link rel=”stylesheet” type=”text/css” 
Href=”mystyle.css”> 
</head> 
Internal Style Sheet 
An internal style sheet should be used when a single document has a unique style. 
You define internal style sheet in the head section with the <style> tag. 
Inline Style 
An internal style sheet should be used when a unique style is to applied to a single 
occurrence of an element. 
To use inline styles you use the style attribute in the relevant tag. The style 
attribute can contain any CSS property. The example shows how to change the color and the left 
margin of a paragraph:
57 
<p style=”color: red; margin-left: 20px”> 
This is a paragraph 
</p> 
Style Tags 
Tag Description 
<style> Defines a style definition 
<link> Defines a resource reference 
<div> Defines a section in a document 
<span> Defines a section in a document 
<font> Deprecated. Use styles instead 
<basefont> Deprecated. Use styles instead 
<center> Deprecated. Use styles instead
58 
HTML Advanced 
Chapter 
HTML Uniform Resource Locators 
8 
HTML Links 
When you click on a link in an HTML document like this: Last Page, an 
underlying <a> tag points to a place (an address) on the Web with an href attribute value like 
this: <a href=”lastpage.html”>Last page</a>. 
The Last Page link in the example is a link that is relative to the Web site that you 
are browsing, and your browser will construct a full Web address like 
http”//www.rgcsm.org/html/ last page .htm to access the page. 
Creating an Email Link 
Building an attractive, useful Web page is only part of the job. You also need to 
give viewers a way to contact you. 
In the digital age, Web users expect to have instant and easy email contact with 
you. To make a link to your email address, you’ll need to use the anchor tag again. You can 
separate you r email contact with the <HR> tag, which inserts a horizontal line. We’ve decided 
to have the email contact link centered on the page. Put it below the list, like this: 
<CENTER> 
<HR> 
<a href=mailto:comments@builder.com”>Drop us a line! </a> 
</CENTER> 
Uniform Resource Locators
Something called a Uniform Resource Locator (URL) is used to address a 
document (or other dada) on the World Wide Web. A full Web address like this: 
http://www.rgcsm.org/jtml/lastpage. htm follows these syntax rules: 
59 
scheme://host.domain:port/path/filename 
The scheme is defining the type of Internet service. The most common type is http. 
The domain is defining the Internet domain name like rgcsm.org. 
The host is defining the domain host. If omitted, the default host for http is www. 
The: port is defining the port number at the host. The port number is normally 
omitted. The default port number for http is 80. 
The path is defining a path (a sub directory) at the server. If the path is normally 
omitted, the resource (the document) must be located at the root directory of the Web site. 
The filename is defining the name of a document. The default filename might be 
default.asp, or index.html or something else depending on the settings of the Web server. 
URL Schemes 
Some examples of the most common schemes can be found below: 
Schemes – Access 
file – a file on your local PC 
ftp – a file on an FTP server 
http – a file on a World Wide Web server 
gopher – a file on a Gopher server 
news – a Usenet newsgroup 
telnet – a Telnet connection 
WAIS – a file on a WAIS server 
Accessing a Newsgroup 
The following HTML code: 
<a href=news:alt.html>HTML Newsgroup</a> 
Creates a link to a newsgroup like this HTML Newsgroup. 
Downloading with FTP 
The following HTML code:
60 
<a href=ftp://www.rgcsm.org/ftp/WinZip.exe>Download WinZip</a> 
Creates a link to download a file like this: Download WinZip. 
(The link doesn’t work. Don’t try it. It is just an example. W3C Schools doesn’t 
really have an ftp directory.) 
Link to your Mail system 
The following HTML code: 
<a href=mailto:someone@rgcsm.com”>someone@rgcsm. Com</a> 
Creates a link to your own mail system like this: 
Someone@rgcsm.com 
HTML Scripts 
Add scripts to HTML pages to make them more dynamic and interactive. 
Insert a Script into HTML Page 
A script in HTML is defined with the <script> tag. Note that you will have to use 
the type attribute to specify the scripting language. <html> 
<head> 
</head> 
<body> 
<script type=”text/javascript”> 
document. write (“Hello World!”) 
</script> 
</body> 
</html> 
The script above will produce this output: 
Hello World! 
How to Handle Older Browsers 
A browser that does not recognize the <script> tag at all, will display the <script> 
tag’s content as text on the page. To prevent the browser from doing this, you should hide the 
script in comment tags. An old browser (that does not recognize the <script> tag) will ignore the 
comment and it will not write the tag’s content on the page, while a new browser will 
understand that the script should be executed, even if it is surrounded by comment tags.
61 
Example 
JavaScript: 
<script type=”text/javascript”> 
<!— 
document.write (“Hello World!”) 
//-- > 
</script> 
VBScript: 
<script type=”text/vbscript”> 
<!-- 
document.write(“Hello World!”) 
‘-- > 
</script> 
The <noscript> Tag 
In addition to hiding the script inside a comment, you can also add a <noscript> 
tag. 
The <noscript> tag is used to define an alternate text if a script is NOT executed. 
This tag is used for browsers that recognize the <script> tag, but do not support the scrip0t 
inside, so these browsers will display the text inside the <noscript> tag instead. However, if a 
browser supports the script inside the <script> tag it will ignore the <noscript> tag. 
Example 
JavaScript: 
<script type=”text/javascript”> 
<!— 
document.write(“Hello World!”) 
//-- > 
</script> 
<noscript>Your browser does not support Java Script! </noscript> 
VBScript:
62 
<script type=”text/vbscript”> 
<!-- 
document.write(“Hello World!”) 
‘-- > 
</script> 
<noscript>Your browser does not support VBScript! </noscript> 
Script Tags 
Tag Description 
<script> Defines a script 
<noscript> Defines an alternate text if the script 
is not executed 
<object> Defines an embedded object 
<param> Defines run=time settings (parameters) 
for an object 
<applet> Deprecated. Use <object> instead 
The Meta Element 
As we explained in the previous chapter, the head element contains general 
information (meta-information) about a document. 
HTML also includes a meta element that goes inside the head element. The 
purpose of the meta element is to provide meta-information about the document. 
Most often the meta element is used to provide information that is relevant to 
browsers or search engines like describing the content of your document. 
Note: W3C states that “Some users agents support the use of META to refresh the 
current page after a specified number of seconds, with the option of replacing it by a different 
URL. Authors should not use this technique to forward users to different pages, as this makes 
the page inaccessible to some users. Instead, automatic page forwarding should be done using 
server-side redirects” 
Keywords for Search Engines 
Some search engines on the WWW will use the name and content attributes of the 
meta tag to index your pages.
This meta element defines a description of your page: 
<meta name=”description” content=”Free Web tutorials on 
63 
HTML, CSS, XML, and XHTML”> 
This meta element defines keywords for your page: 
<meta name=”keywords” content=”HTML, DHTML, CSS, XML, 
XHTML, JavaScript, VBScript”> 
The intention of the name and content attributes is to describe the content of a 
page. 
However, since too many webmasters have used meta tags for spamming, like 
repeating keywords to give pages a higher ranking, some search engines have stopped using 
them entirely. 
Unknown Meta Attributes 
Sometimes you will see meta attributes that are unknown to you like this: 
<meta name=”security “content=”low”> 
Then you just have to accept that this is something unique to site or to the author 
of the site, and that it has probably no relevance to you. 
HTML 4.0 Standard Attributes 
HTML tags can have attributes. The special attributes for each tag are listed under 
each tag description. The attributes listed here are the core and language attributes that are 
standard for all tags (with a few exceptions): 
Core Attributes 
Not valid in base, head, html, meta, param, script, style, and title elements. 
Attribute Value Description 
class class_rule or style_rule The class of the element 
id id_name A unique id for the element
style style_definition An inline style definition 
title tooltip_text A text to display in a tool tip 
64 
Language Attributes 
Not valid in base, br, frame, frameset, hr, iframe, param, and script elements 
Attribute Value Description 
dir ltr | rtl Sets the text direction 
lang language_code Sets the language code 
Keyboard Attributes 
Attribute Value Description 
accesskey character Sets a keyboard 
shortcut to access 
an element 
tabindex number Sets the tab order 
of an element 
HTML 4.0 Event Attributes 
New to HTML 4.0 is the ability to let HTML event trigger actions in the browser, 
like starting a JavaScript when a user clicks on an HTML element. Below is a list of attributes 
that can be inserted into HTML tags to define event actions. 
Window Events 
Only valid in body and frameset elements. 
Attribute value Description 
onload script Script to be run when a 
document loads 
onunload script Script to be run when a 
document unloads 
Form Element Events
65 
Only valid in form elements. 
Attribute Value Description 
onchange script Script to be run when the 
element changes 
onsubmit script Script to be run when the 
form is submitted 
onresel script Script to be run when the 
form is resel 
onselect script Script to be run when the 
element is selected 
onblur script Script to be run when the 
element loses focus 
onfocus script Script to be run when the 
element gets focus 
Keyboard Events 
Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, 
style, and title elements. 
Attribute Value Description 
onkeydown script what to do when key is pressed 
onkeypress script what to do when key is pressed and released 
onkeyup script what to do when key is released 
Morse Events 
Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, 
style, and title elements. 
Attribute Value Description 
onclick script What to do on a mouse click 
ondblclick script What to do on a mouse 
double-click 
onmousedown script What to do on a mouse 
button is pressed 
onmousemove script What to do on a mouse 
pointer moves 
onmousout script What to do on a mouse 
pointer moves out of an
66 
element 
onmousover script What to do on a mouse 
pointer moves over an element 
onmouseup script What to do on a mouse 
button is released 
Web Publishing 
Your First Step: A Personal Web Server 
· If you want other people to view your pages, you must publish them. 
· To publish your work, you have to copy your files to a web server. 
· Your own PC can act as a web server if it is connected to a network. 
· If you are running Windows 98, you can use the PWS (personal Web Server). 
· PWS is hiding in the PWS folder in your Windows CD. 
Personal Web Server (PWS) 
PWS turns any Windows computer into a Web server. PWS is easy to install and 
ideal for developing and testing Web application. PWS has been optimized for working use, but 
has all the requirements of a full Web server. It also runs Active Server Pages (ASP) just like its 
larger brother IIS. 
How to Install a Personal Web Server (PWS) 
Browser your Window installation to see if you have installed PWS. If not, install 
PWS from the PWS directory on your Window CD. Follow the instructions and get your 
personal Web Server up and running. 
Note: Microsoft Windows XP Home Edition does not come with the option to turn 
your computer into a PWS! Internet Information Server(IIS) 
Windows 2000’s built-in Web server IIS, makes it easy to build large applications 
for the Web. Both PWS and IIS include ASP, a server- side scripting standard that can be used 
to create dynamic, and interactive Web applications, IIS is also available for Windows NT. 
Your Next Step: A Professional Web Server 
· If you do not want to use PWS or IIS, you must upload your files to a 
public server. 
· Most Internet Service Providers (ISP’s) will offer to host your web pages.
· If your employer has an Internet Server, you can ask him to host your Web 
67 
site. 
· If you are really serious about this, you should install your own Internet 
Server.
Introduction to Dynamic HTML? 
Chapter 
Web authors today face significant challenges when making their Web pages 
9 
interactive. The static nature of HTML pages limits their creative choices, and interactive 
components can be difficult to build and reuse. In addition, using proprietary extensions means 
authoring browser-specify Web pages. 
Microsoft Dynamic HTML technology helps to remove these barriers for content 
providers and offers users more engaging and interactive Web pages. Dynamic HTML provides 
authors with enhanced creative control so they can manipulate any page element at any time. 
Dynamic HTML is also the easiest way to make Web pages interactive, using open, standards-based 
technologies. Microsoft is working with the World Wide Web Consortium (W3C) to help 
ensure interoperability and support for users on multiple systems with different browsers. 
According to Microsoft DHTML (first implemented in IE 4.0) is a set of 
innovative features which allows web developers to change the rendering and content of a 
document on the fly without relying on server-side program (such as Active Server Pages or 
ColdFusion) or complicated sets of HTML pages to achieve special effects. 
DHTML can be described as an interface which makes it possible to access the 
68 
browser object model though JavaScript or VBScript scripting language. 
This way you can control your page more efficiently. And yes, you can actually 
make a page without HTML tags at all! 
DHTML is the art of making HTML pages dynamic! 
DHTML is a combination of technologies used to create dynamic and interactive 
Web sites. 
To most people DHTML means a combination of HTML, Style Sheets and 
JavaScript. 
What is DHTML?
“DHTML is the combination of several built-in browser features in fourth 
69 
generation browsers that enable a web page to be more dynamic” 
DHTML is NOT a scripting language (like JavaScript), but merely a browser 
feature-or enhancement-that gives your browser the ability to be dynamic. What you really want 
to learn is not DHTML itself, but rather, the syntax needed to use DHTML. 
DHTML is a collection features that together, enable your web page be dynamic. I 
think its important now to define just what is meant by Dynamic? 
“Dynamic” is defined as the ability of the browser to alter a web page’s look and 
style after the document has loaded. I remember when I was learning JavaScript, I was taught 
that you could use document. Writer () method of JavaScript to create webpages on the fly. For 
example: 
<script> 
document.write (“This is text created on the fly!”) 
</script> 
But what if we wanted to create content not only on the fly, but on demand? We 
can do that, by nesting the above code in a function, and calling it via a form button: 
<input type=”button” onClick=”writeconent()” value=”text”> 
Pressing the button will erase the entire web page and we were left with only the 
text the function produced. 
That was back then. Now, with the introduction of DHTML, we can alter content 
on a web page on demand, whenever we feel like it, without having the browser erase 
everything else. That’s what DHTML is all about. The ability of the browser to change look and 
style even after the document has loaded. 
The technology of DHTML is currently at its development stage, with NE, IE 5 
differing quite greatly in their implementation of this great technology. Its currently not possible 
to write one DHTML code and expect it to function in both browsers properly. Furthermore, the 
two browsers are at different stages in their development of DHTML; form my own knowledge 
and what I’ve heard, DHTML in IE is far more powerful and versatile then NS’s. 
Dynamic HTML Features 
Dynamic HTML gives authors enhanced control of the elements on their pages. 
When you have applied one of the FrontPage Dynamic HTML commands to text or graphics, 
Microsoft Internet Explorer 4.0 and other Web browsers that support Dynamic HTML will
animate the text or graphics or apply other effects that you select. Because it does not require 
fetching information from the web server, Dynamic HTML is very efficient, and presents the 
user with a lively, compelling page without requiring time- consuming network activity. 
The FrontPage Editor includes the following Dynamic HTML features: 
· Animation 
· Page transitions 
· Outlining 
· Form enhancements 
Key features of Dynamic HTML include these: 
· Document Object Model (DOM). Dynamic HTML provides a comprehensive 
object model for HTML. This model exposes all page elements as objects. These objects can 
easily be manipulated, by changing their attributes or applying methods to them at any time. 
Dynamic HTML also provides full support for keyboard and mouse events on all page elements. 
Support for the Document Object Model enables the following: 
· Dynamic content. Text or graphics can be added, deleted, or modified on the 
flu. For example, a Web page can display an updated headline, without refreshing the page. The 
text surrounding the headline will reflow automatically. 
· Dynamic styles. Internet Explorer 4.0 fully supports cascading Style Sheets 
(CSS). As such, any CSS attribute, including color and font, can be updated without a server 
round-trip. For instance, text can change color or size when a mouse pointer passes over it. 
Multimedia filters and transition effects can be applied to HTML elements simply by adding the 
filter CSS attribute. 
· Absolute positioning. CSS positioning coordinates for existing page content 
70 
can be updated at any tine to create animated effects, without reloading the page. 
· Data Binding. Data-driven application front ends can be built that present, 
manipulate (e.g., sort, filter), and update data on the client without numerous round-trips to the 
server. 
· Scriptlets. A Scriptlets is a Web page, authored with Dynamic HTML, which 
content providers can use as a component in their Web applications. With Scriptlets, content 
providers can author content once, then easily reuse the content in other Web pages or 
applications.
71 
Understanding Interactivity 
It is important to define interactivity for the purposes of this guide. The following 
criteria are suggested for defining a truly interactive Web page: 
“The page author must be able to update any element of the page at any time— 
during and after the loading of the page. 
· The page should capture all user actions and enable authors to respond to these 
events using simple scripts. 
· The page should reflect the relationship among page elements. A change to one 
element in the page may require readjusting other elements. An interactive page should do this 
automatically. 
· If authors so choose, users should be able to freely change any element in the 
page at any time. 
What you should already know 
Before you continue you should have a basic understanding of the following: 
· HTML 
· CSS 
· JavaScript 
Cascading Style Sheets are design templates that provide augmented control over 
presentation and layout of HTML elements. They allow you to separate the way you design 
information from the HTML content. 
JavaScript is used to create interactive web application supported by the Netscape 
browser. JavaScript offers many of the same advantages as VBScript. JavaScript is simple to 
use, lightweight, and dynamic. Developers can easily code functionality for interactive 
applications inside a web page. 
DHTML is NOT a W3C Standard 
DHTML stands for Dynamic HTML. 
DHTML is not a standard defined by the World Wide Web Consortium (W3C). 
DHTML is a “marketing term” – used by Netscape and Microsoft to describe the new 
technologies the 4.x generation browsers would support.
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html
Introduction to Html

Weitere ähnliche Inhalte

Was ist angesagt?

Web 3.0 & IoT (English)
Web 3.0 & IoT (English)Web 3.0 & IoT (English)
Web 3.0 & IoT (English)Peter Waher
 
Internet tools and services
Internet tools and servicesInternet tools and services
Internet tools and serviceslearnt
 
Activity 13 common online terminologies
Activity 13 common online terminologiesActivity 13 common online terminologies
Activity 13 common online terminologiesYeyyy
 
Internet Tools in Education
Internet Tools in EducationInternet Tools in Education
Internet Tools in EducationRavi Raj Kamal
 
Eff use of internet
Eff use of internetEff use of internet
Eff use of internetstreetman921
 
11. introduction to internet
11. introduction to internet11. introduction to internet
11. introduction to internetTimesRide
 
Jarrar: The Next Generation of the Web 3.0: The Semantic Web
Jarrar: The Next Generation of the Web 3.0: The Semantic WebJarrar: The Next Generation of the Web 3.0: The Semantic Web
Jarrar: The Next Generation of the Web 3.0: The Semantic WebMustafa Jarrar
 
Putting Library 2.0 into Pratice
Putting Library 2.0 into PraticePutting Library 2.0 into Pratice
Putting Library 2.0 into PraticeThor Dekov Buur
 
INTRODUCTION TO INTERNET AND WWW
INTRODUCTION TO INTERNET AND WWWINTRODUCTION TO INTERNET AND WWW
INTRODUCTION TO INTERNET AND WWWProf Ansari
 
Lesson 2 Presentation
Lesson 2 PresentationLesson 2 Presentation
Lesson 2 PresentationKereen Tatham
 
Familiarization with Web Tools
Familiarization with Web ToolsFamiliarization with Web Tools
Familiarization with Web ToolsMarlon Jamera
 
Basic Internet Concepts
Basic Internet ConceptsBasic Internet Concepts
Basic Internet ConceptsKiran Budhrani
 
Semantic Web: Intro
Semantic Web: IntroSemantic Web: Intro
Semantic Web: IntroFariz Darari
 
A basic guide to the internet
A basic guide to the internetA basic guide to the internet
A basic guide to the internetarunabhatla
 
Eba ppt rajesh
Eba ppt rajeshEba ppt rajesh
Eba ppt rajeshRajeshP153
 

Was ist angesagt? (19)

Internet Technology Basics
Internet Technology BasicsInternet Technology Basics
Internet Technology Basics
 
A short introduction to Semantic Web - 2012
A short introduction to Semantic Web - 2012A short introduction to Semantic Web - 2012
A short introduction to Semantic Web - 2012
 
Web 3.0 & IoT (English)
Web 3.0 & IoT (English)Web 3.0 & IoT (English)
Web 3.0 & IoT (English)
 
Internet tools and services
Internet tools and servicesInternet tools and services
Internet tools and services
 
Activity 13 common online terminologies
Activity 13 common online terminologiesActivity 13 common online terminologies
Activity 13 common online terminologies
 
Internet Tools in Education
Internet Tools in EducationInternet Tools in Education
Internet Tools in Education
 
Eff use of internet
Eff use of internetEff use of internet
Eff use of internet
 
11. introduction to internet
11. introduction to internet11. introduction to internet
11. introduction to internet
 
Jarrar: The Next Generation of the Web 3.0: The Semantic Web
Jarrar: The Next Generation of the Web 3.0: The Semantic WebJarrar: The Next Generation of the Web 3.0: The Semantic Web
Jarrar: The Next Generation of the Web 3.0: The Semantic Web
 
Putting Library 2.0 into Pratice
Putting Library 2.0 into PraticePutting Library 2.0 into Pratice
Putting Library 2.0 into Pratice
 
INTRODUCTION TO INTERNET AND WWW
INTRODUCTION TO INTERNET AND WWWINTRODUCTION TO INTERNET AND WWW
INTRODUCTION TO INTERNET AND WWW
 
Web technology
Web technologyWeb technology
Web technology
 
W 11 internet & www
W 11 internet & wwwW 11 internet & www
W 11 internet & www
 
Lesson 2 Presentation
Lesson 2 PresentationLesson 2 Presentation
Lesson 2 Presentation
 
Familiarization with Web Tools
Familiarization with Web ToolsFamiliarization with Web Tools
Familiarization with Web Tools
 
Basic Internet Concepts
Basic Internet ConceptsBasic Internet Concepts
Basic Internet Concepts
 
Semantic Web: Intro
Semantic Web: IntroSemantic Web: Intro
Semantic Web: Intro
 
A basic guide to the internet
A basic guide to the internetA basic guide to the internet
A basic guide to the internet
 
Eba ppt rajesh
Eba ppt rajeshEba ppt rajesh
Eba ppt rajesh
 

Ähnlich wie Introduction to Html

The Factors For The Website
The Factors For The WebsiteThe Factors For The Website
The Factors For The WebsiteJulie May
 
An Introduction to Cyber World to a Newbie
An Introduction to Cyber World to a NewbieAn Introduction to Cyber World to a Newbie
An Introduction to Cyber World to a NewbieAnuj Khandelwal
 
ICS 2203-WEB APPLICATION DEVELOPMENT-EDUC Y2S1_MATHCOMP.docx
ICS 2203-WEB APPLICATION DEVELOPMENT-EDUC Y2S1_MATHCOMP.docxICS 2203-WEB APPLICATION DEVELOPMENT-EDUC Y2S1_MATHCOMP.docx
ICS 2203-WEB APPLICATION DEVELOPMENT-EDUC Y2S1_MATHCOMP.docxMartin Mulwa
 
internet principles of operation By ZAK
internet principles of operation By ZAKinternet principles of operation By ZAK
internet principles of operation By ZAKTabsheer Hasan
 
MADS4007_Fall2022-Intro to Web Technologies.docx.pptx
MADS4007_Fall2022-Intro to Web Technologies.docx.pptxMADS4007_Fall2022-Intro to Web Technologies.docx.pptx
MADS4007_Fall2022-Intro to Web Technologies.docx.pptxawadalsabbah
 
Nt1310 Final Exam Questions And Answers
Nt1310 Final Exam Questions And AnswersNt1310 Final Exam Questions And Answers
Nt1310 Final Exam Questions And AnswersLisa Williams
 
Network Basics & Internet
Network Basics & InternetNetwork Basics & Internet
Network Basics & InternetVNSGU
 
Discovering Heterogeneous Resources in the Internet
Discovering Heterogeneous Resources in the InternetDiscovering Heterogeneous Resources in the Internet
Discovering Heterogeneous Resources in the InternetRazzakul Chowdhury
 
what is internet
what is internetwhat is internet
what is internetdheeru143
 
Web engineering 2(lect 0)
Web engineering 2(lect 0)Web engineering 2(lect 0)
Web engineering 2(lect 0)Roohul Amin
 

Ähnlich wie Introduction to Html (20)

The Factors For The Website
The Factors For The WebsiteThe Factors For The Website
The Factors For The Website
 
An Introduction to Cyber World to a Newbie
An Introduction to Cyber World to a NewbieAn Introduction to Cyber World to a Newbie
An Introduction to Cyber World to a Newbie
 
ICS 2203-WEB APPLICATION DEVELOPMENT-EDUC Y2S1_MATHCOMP.docx
ICS 2203-WEB APPLICATION DEVELOPMENT-EDUC Y2S1_MATHCOMP.docxICS 2203-WEB APPLICATION DEVELOPMENT-EDUC Y2S1_MATHCOMP.docx
ICS 2203-WEB APPLICATION DEVELOPMENT-EDUC Y2S1_MATHCOMP.docx
 
Web standards
Web standards Web standards
Web standards
 
html5 project.pptx
html5 project.pptxhtml5 project.pptx
html5 project.pptx
 
internet principles of operation By ZAK
internet principles of operation By ZAKinternet principles of operation By ZAK
internet principles of operation By ZAK
 
MADS4007_Fall2022-Intro to Web Technologies.docx.pptx
MADS4007_Fall2022-Intro to Web Technologies.docx.pptxMADS4007_Fall2022-Intro to Web Technologies.docx.pptx
MADS4007_Fall2022-Intro to Web Technologies.docx.pptx
 
Nt1310 Final Exam Questions And Answers
Nt1310 Final Exam Questions And AnswersNt1310 Final Exam Questions And Answers
Nt1310 Final Exam Questions And Answers
 
Iwt module 1
Iwt  module 1Iwt  module 1
Iwt module 1
 
web technology
 web technology web technology
web technology
 
Web engineering lecture 3
Web engineering lecture 3Web engineering lecture 3
Web engineering lecture 3
 
Network Basics & Internet
Network Basics & InternetNetwork Basics & Internet
Network Basics & Internet
 
WEB DESIGNING.pptx
WEB DESIGNING.pptxWEB DESIGNING.pptx
WEB DESIGNING.pptx
 
Discovering Heterogeneous Resources in the Internet
Discovering Heterogeneous Resources in the InternetDiscovering Heterogeneous Resources in the Internet
Discovering Heterogeneous Resources in the Internet
 
Resource Discovery Paper.PDF
Resource Discovery Paper.PDFResource Discovery Paper.PDF
Resource Discovery Paper.PDF
 
what is internet
what is internetwhat is internet
what is internet
 
Internet
InternetInternet
Internet
 
Www(alyssa) (2)
Www(alyssa) (2)Www(alyssa) (2)
Www(alyssa) (2)
 
Web engineering 2(lect 0)
Web engineering 2(lect 0)Web engineering 2(lect 0)
Web engineering 2(lect 0)
 
Module 3
Module 3Module 3
Module 3
 

Mehr von Vineet Kumar Saini (20)

Abstract Class and Interface in PHP
Abstract Class and Interface in PHPAbstract Class and Interface in PHP
Abstract Class and Interface in PHP
 
Add edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHPAdd edit delete in Codeigniter in PHP
Add edit delete in Codeigniter in PHP
 
Computer Fundamentals
Computer FundamentalsComputer Fundamentals
Computer Fundamentals
 
Country State City Dropdown in PHP
Country State City Dropdown in PHPCountry State City Dropdown in PHP
Country State City Dropdown in PHP
 
Pagination in PHP
Pagination in PHPPagination in PHP
Pagination in PHP
 
Stripe in php
Stripe in phpStripe in php
Stripe in php
 
Php Tutorials for Beginners
Php Tutorials for BeginnersPhp Tutorials for Beginners
Php Tutorials for Beginners
 
Install Drupal on Wamp Server
Install Drupal on Wamp ServerInstall Drupal on Wamp Server
Install Drupal on Wamp Server
 
Joomla 2.5 Tutorial For Beginner PDF
Joomla 2.5 Tutorial For Beginner PDFJoomla 2.5 Tutorial For Beginner PDF
Joomla 2.5 Tutorial For Beginner PDF
 
Functions in PHP
Functions in PHPFunctions in PHP
Functions in PHP
 
Sorting arrays in PHP
Sorting arrays in PHPSorting arrays in PHP
Sorting arrays in PHP
 
Dropdown List in PHP
Dropdown List in PHPDropdown List in PHP
Dropdown List in PHP
 
Update statement in PHP
Update statement in PHPUpdate statement in PHP
Update statement in PHP
 
Delete statement in PHP
Delete statement in PHPDelete statement in PHP
Delete statement in PHP
 
Implode & Explode in PHP
Implode & Explode in PHPImplode & Explode in PHP
Implode & Explode in PHP
 
Types of Error in PHP
Types of Error in PHPTypes of Error in PHP
Types of Error in PHP
 
GET and POST in PHP
GET and POST in PHPGET and POST in PHP
GET and POST in PHP
 
Database connectivity in PHP
Database connectivity in PHPDatabase connectivity in PHP
Database connectivity in PHP
 
Arrays in PHP
Arrays in PHPArrays in PHP
Arrays in PHP
 
Programming in C
Programming in CProgramming in C
Programming in C
 

Kürzlich hochgeladen

Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room servicediscovermytutordmt
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 

Kürzlich hochgeladen (20)

Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
9548086042 for call girls in Indira Nagar with room service
9548086042  for call girls in Indira Nagar  with room service9548086042  for call girls in Indira Nagar  with room service
9548086042 for call girls in Indira Nagar with room service
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 

Introduction to Html

  • 1. 1 Introduction to Web and HTML Chapter What is the World Wide Web? World Wide Web- the web, for short- is a network of computer able to exchange text, graphics, and multimedia information via the internet. By sitting at a computer that is attached to the web, using either a dialup phone line or a much faster broadband (Ethernet, cable, or DSL connection, you the can visit web- connecters next door, at a nearby university, or halfway around the world. And you can take full advantage of the resources these computers make available, including text, graphics, videos, sounds, and animation. Think Of the web as the multimedia version of the internet, and you’ll be right on the mark. The World Wide Web has come a long way from its humble beginnings, most internet historians recognize Gopher as the precursor to the web. Gopher was a revolutionary search tool that allowed the user to search hierarchical archives of textual documents. It enabled internet users to easily search, retrieve. And share information. Today’s World Wide Web is capable of delivering information via any number of medium-text, audio, video. The content can be dynamic and even interactive. However, the web is not a panacea. The standards that make up the HTTP protocol are implemented in different ways by different browsers. What works on one platform may not work the same, if at all, on the next. Newly web- enabled devices- PDAs, cell phones, appliances, and so on- are still searching fop a suitable form of HTML to standardize on. How Does the web work? The computers that make all these web pages available are called web servers. On any computer that’s connected to the web, you can rub nab application called a web browser. Technically, a web browser is called a web client-that is, a program that’s able to contact a web server and request Information When the web server receives the requested information, it looks for this information within its file system, and sends out the requested information via the internet. They all speak a common “language,” called Hyper Text Transfer protocol (HTTP). (HTTP isn’t really a language like the ones people speak. It’s a set of rules or procedures, called protocols that enable computers to exchanges information over the web.) Regardless of where these computer reside-china., Nor- way, or Austin, Texas-they can communication with each other through HTTP. The following illustrates how HTTP works (see figure) 1
  • 2. · Most web pages contain hyperlinks, which are specially formatted words or phrases that enable you to access another page on the web. Although the hyperlink usually doesn’t make the address of this page visible, it contains all the information needed for your computer to request a web page form another computer. · When you click the hyperlink your computer sends a message called an HTTP 2 request. The message says, in effect,” Please send me the web page that I want.” The web server receives the request, and looks within its stored files for the web page you request. When it finds the web page, it sends it to your computer, and your web browser displays it. If the page isn’t founds, you see an error message, which probably the HTTP code for this error’ 404 “Not found.” Figure: The client requests the page. Then the server evaluates the request and server the page or an error message. What Is Hypertext? You probably noticed the word “hypertext” in the spelled- out version of HTTP, Hypertext Transfer Protocol. Originated by computing pioneer Theodore Nelsons, the term “hypertext “doesn’t mean “text that can’t sit still,” although some web authors do use a much-despised HTTP code that makes the text blink on- screen. Insert, the tern is an analogy to a time-honored (but physically impossible) science fiction concept, the hyperspace jump, which enables a starship to go immediately form one star system to another. Hypertext is a types of text
  • 3. that contains hyperlinks (or just links for short), which enable the reader to jump form ones hypertext page to another. You may also hear the word hypermedia. A hypermedia system works just like hypertext, except that it includes graphics, sounds, videos, and animation as well as text. In contrast to ordinary text, hypertext gives readers the ability to choose their own path through the material that interests them. A book is designed to be read in sequence; page 2 follows page 1, and so on. Sure, you can skip around, but books don’t provide much help, beyond including an index. Computer – based hypertexts let readers jump around all they want. The computer part is important because it’s hard to build a hypertext system out of physical media, such as index cards or pieces of paper The web is a giant computer- based hypermedia system, and you’ve probably already done lost of jumping around from one page to another on the web-it’s called surfing. If one web page doesn’t seem all that interesting once you visit, you can click another link that seems more related to your needs (and so on). The web makes surfing so easy that you’ll need to give some thought to keeping people on your sites-keeping them engaged and interested-so they won’t surf away! Where Dose HTML Fit In? Hypertext Markup Language (HTML) enables you to mark up text so that it can function as hypertext on the web. The term markup comes form printing; editors mark up manuscript pages with funny- looking symbols that tell printer how to print the page. HTML consists of its own set of funny-looking symbols that tell web browsers how to display the page, These symbols, called elements, include the ones needed to create hyperlinks. The Hyper Text Markup Language (HTML) IS A Simple markup language that describes the structure and behavior of Web document. HTML is the standard language that all Web browsers are designed to; understand and interpret. HTML is implemented using another larger markup language—the Standard Generalized Markup Language, usually known by its acronym, SGML The invention of HTML HTML and HTTP were both invented by Tim Berners-Lee, who was then working as a computer and networking specialist at a Swiss research institute. He wanted to give the Institute’s researchers a simple markup language, which would enable them to; share their research pares via the internet. Berners-Lee based HTMNL on Standard Generalized Markup Language (SGML), an international standard for mar5king up text for presentation on a variety of physical devices. The basic idea of SGML is that the document’s structure should be separated form its presentation: 3
  • 4. · Structure refers to the var5ious components or parts of a document that authors create, such as titles, paragraphs, headings, and lists. Fir example, you’re reading an item in an unordered list, as it is termed in SGML (most people use the more familiar bulleted list). In SGML, you markup this item as a bulleted list, but you don’t say anything about how it’s supposed to look. That’s left up to whatever device displays or prints the marked-up file · Presentation refers to the way these various components are actually displayed by a given media device, such as a computer or a printer. For example, this book displays this bulleted list item with an indentation and other special formatting. · What’s so great about separating structure from presentation? There are several 4 very important advantages: · Authors usually aren’t very good designers. It’s wise, especially in large organizations. To let writers compose their documents, and let designers worry about how the documents are supposed to look. That’s particularly true when an organization has a corporate look or style, such as Apple computer’s standard typeface, which you’ll see in all of its documents. T he designers make sure that every document produced with the organization conforms to that style. So SGML doesn’t contain any features that control presentation. · If markup consists of structure alone, the document’s appearance can be changed quickly. All that’s necessary is to change the presentation settings on whatever device is displaying the document. · Documents containing only structural markup are much easier and cheaper to maintain. When presentation markup is included along with structural markup, the document becomes an unmanageable mess, and maintenance costs skyrocket. · If a document contains only structural markup, it is more accessible to people with limited vision or other physical limitations. For example, a document marked up structurally might be presented by a Braille printer for those with limited vision, or by a text reader for those with limited hearing. Sounds great, right? Still, from the beginning, HTML didn’t make the structure versus presentation distinction as clearly as SGML purists would have liked. And as HTML developed and the internet became a commercial network, Web authors demanded more tools to make their documents look attractive on-screen. The companies that make web browsers responded by introducing new, nonstandardized HTML elements that contained presentation information. By 1996, many web experts were worried that HTML standards were spiraling out of control. The newly founded world wide consortium, hoping to deep at least some kind of standard in place, tried to standardize existing practices, including the use of presentation and structure. The result was the W3C’s HTML 3.2 standard, which is still widely used. But
  • 5. organizations found that HTML3.2 exposed them to excessive maintenance cists. The SGML purists were right: Structure and presentation should have been kept separate 5 A Short History of HTML To date, HTML has gone through four major standards, including the latest 4.01. In addition to the HTML standards, cascading style sheets and XML have also provided valuable contributions to Web standards. The following sections provide a brief overview of the various versions and technologies. HTML 1.0 HTML 1.0 was never formally specified by the W3C because the W3C came along too late It was the original specification Mosaic 1.0 used, and it supported few element. What you couldn’t do on a page is more interesting than what you could do. You couldn’t set the background color or background image of the page. There were no tables or frames. You couldn’t dictate the font. All inline images had to be GIFs; JPEGs were used for out-of-line images. And there were no forms. Every page looked pretty much the same: gray background and Times Roman font. Links were indicated in blue until you’d visited them and then they were red. Because scanners and image- manipulation software weren’t as available the, image limitation wasn’t a huge problem. HTML 1.0 was only implemented in Mosaic and Lynx (a text-only browser that runs under UNIX). HTML 2.0 Huge strides forward were made between HTML 1.0 AND html2.0. An HTML 1.1 actually did exist, created by Netscape to support what its first browser could do. Because only Netscape and Mosaic were available at the time (both written under the leadership of Marc Andreesen), browser makers were in the habit of adding their own new features and creating names for HTML elements to use those features. Between HTML1.0 and HTML 2.0, the W3C also came into being, under the leadership of Tim Berners-Lee, founder of the web. HTML 2.0 was a huge improvement over HTML 1.0 Back-ground colors and images could be set. Forms became available With a limited set of fields, but nevertheless, for first time, visitors to a web page could submit information. Tables also became possible.
  • 6. 6 HTML 3.2 Why no 3.0? The W3C couldn’t get a specification out in time for agreement by the members. HTML 3.2 was vastly richer than HTML 2.0. It included support for style sheets (CSS level 1). Even though CSS was supported in the 3.2 specification, the browser manufacturers didn’t support CSS well enough for a designer to make use of it. HTML 3.2 expanded the number of attributes that enabled designers to customize the look of a page (exactly the opposite of HTML 4). HTML 3.2 didn’t include support for frames, but the browser makers implemented them anyway. NOTE a page with two frames is actually processed like three separate pages within your browser. The outer page is the frameset. The frameset indicates to the browser, which pages go where in the browser window. Implement a web site. A common use for frames is navigation in the left pane and content in the right. HTML 4.0 What does HTML 4.0 add? Not so much new elements- although those do exist-as a rethinking of the direction HTML is taking. Up until now, HTML has encouraged interjecting presentation information into the page. HTML 4.0 now clearly deprecates any uses of HTML that relate to forcing a browser to format an element a certain way. All formatting has been moved into the style sheets. With formatting information strewn throughout the page, HTML 3.2 had reached a point where maintenance was expensive and difficult. This movement of presentation out of the document, once and for all, should facilitate the continued rapid growth of the web. Tip Use the W3C MarkUp validation service, available at http://validator .w3.org/ , to check your HTML against most of the versions mentioned in this chapter. XML 1.0 Extensible Markup Language (XML) was originally designed to meet the needs of large-scale electronic publishing. As such, it was designed to help separate structure from presentation and provide enough power and flexibility to be applicable in a variety of publishing applications. In fact, many modern word processing contain XML components or even export their documents in XML-compliant formats. CSS 1.0 AND 2.0 Cascading Style Sheets (CSS) were designed to help move formatting out of the HTML specification. Much like styles in a word processing program, CSS provides a mechanism to easily specify and change formatting without changing the underlying code. The
  • 7. “cascade” in the name comes from the fact that the specification allows for multiple style sheets to interact, allowing individual Web document to be formatted slightly different from their kin (following department document guidelines but still adhering to the company standards, for example). The second version of CSS (2.0) builds on the capabilities of the first version, adding more attributes and properties for a Web designer to draw upon. 7 HTML 4.01 HTML 4.01 is a minor revision of the HTML 4.0 standard. In addition to fixing errors identified since the inception of 4.0, HTML 4.01 also provides the basic for meaning of XHTML elements and attributes, reducing the size of the XHTML 1.0 specification XHTML 1.0 Extensible Hyper Text Markup Language (XHTML) is the first specification for the HTML and XML cross-breed. XHTML was created to be the next generation of markup language, infusing the standard of HTML with the extensibility of XML. It was designed to be used in XML compliant environments, yet compatible with standard HTML 4.01 user agents. What is an HTML File? · HTML stands for Hyper Text Markup Language · An HTML file is a text file containing small markup tags · The markup tags tell the Web browser how to display the page · An HTML file must have an htm or html file extension · An HTML file can be created using a simple text editor Creating an HTML Document If you are running Window, start Notepad. If you are on a Mac, start simple Text. In OSX start Text Edit and change the following preferences: Open the “Format” menu and select “Plain text” instead of “Rich text “. Then open the “preferences “window under the “Text Edit” menu and select “Ignore rich text commands in HTML file “. Your HTML code will probably not work if you do not change the preferences above! Type in the following text:
  • 8. 8 <html> <head> <title>Title of page </title> </head> <body> This is my first homepage. <b> This text is bold </b> </body> </html> Save the file as “mypage.html”. Start your internet browser “Open “ (or “Open page”) in the file menu of your browser. A dialog box will appear. Select “Browser” (or “Choose File “) and locate the HTML file you just created – “mypage.htm” –select it and click “Open “. Now you should see an address in the dialog box, foe example “C:My Documentmypage.htm”. Click OK, and the browser will display the page. The first tag in your HTML document is <html>. This tag tells your browser that this is the state of an HTML document. The last tag in your document is </html>. This tag tells your browser that this is the end of the HTML document. The text between the <head> tag and the </head> tag is header information. Header information is not displayed in the browser window. The text between the <title> tags is the title of your document. The title is displayed in your browser’s caption. The text between the <body> tags is the text that will be displayed in your browser. The text between the <b> and </b> tags will be displayed in a bold font. HTM or HTML Extension? When you save an HTML file, you can use either the .htm or the html extension. We have used .htm in our examples. It might be a bad habit inherited from the past when some of he commonly used software only allowed three letter extensions. With newer software we think it will be perfectly safe to use.html.
  • 9. 9 Basic HTML Tags And Elements Chapter HTML Elements HTML documents are text files made up of HTML elements. HTML elements are defined using HTML tags HTML Tags · HTML tags are used to mark- up HTML elements · HTML tags are surrounded by the two characters <and> · The surrounding character are called angle brackets · HTML tags normally come in pairs like <b> and </b> · The first tag in a pair is the state tag, the second tag is the end tag · The text between the start and end tags is the element content · HTML tags are not case sensitive, <b> means the same as <B> HTML Elements Remember the HTML example from the previous page: <html> <head> <title> Title of page </title> </head> <body> This is my first homepage. </body> </html> This is an HTML element: 2
  • 10. 10 <b> This text is bold </b> The HTML element starts with a start tag: <b> The content of the HTML element is: This text is bold The HTML element ends with an end tag: </b> The purpose or the <b> tag is to define an HTML element that should be displayed as bold. This is also an HTML element: <body> This is my first homepage. <b> This text is bold</b> </body> This HTML element starts with the stat tag <body>, and ends with the end tag </body> The purpose of the <body> tag is to define the HTML element that contains the body of the HTML document. Why do We Use Lowercase Tags? We have just said that HTML tags are not case sensitive: <b> means the same as <b>. If you surf the web, you will notice that plenty of web sites use uppercase HTML tags in their source code. We always use lowercase tags. Why? If you want to follow the latest web standards, you should always use lowercase tags. The World Wide Web Consortium (W3C) recommends lowercase tags in their HTML 4 recommendation, and XHTML (the next generation HTML) demands lowercase tags. Basic HTML Tags The most important tags in HTML are tags that define headings, paragraphs and line breaks. The best way to learn HTML is to work with examples. We have created a very nice HTML editor for you. With this editor; you can edit the HTML source code if you like, and click on a test button to view the result. The Overall Structure: HTML, Head, and Body All HTML documents have three, document-level tags in common. These tags,<html>, <head>,and <body>, delimit certain sections of the HTML document. The <html> tag
  • 11. The <html> tag surrounds the entire HTML document. This tag tells the client 11 browser where the document begins and ends. <html> …..document contents…. </html> Additional language options were declared within the <html> tag in previous versions of HTML. However, those options (notably lang and dir) have been deprecated in HTML version 4.0 The language and directional information is routinely contained in the <head> section. A typical <head> section could resemble the following: <head> <link rel=”stylesheet” type=”text/css” href=”/styles.css”> <title>TITLE OF THE Document</title> <meta name= “description” content= “Sample Page”> <meta name= “keywords” content= “sample, heading, page”> <script language= “JavaScript “> Function New Window (url) { Fin= window. open (url,””, “width=800, height=600, scrollbars=yes, resizable=yes”); } </script> </head> Most of the content within the <head> section will not be visible on the rendered page in the client’s browser. The <title> element determines what the browser displays as the page title-on Windows machines, the document title appears in the browser’s title bar, as shown in Figure2-1. Document title
  • 12. Figure: In windows, the document’s <title> appears in the browser’s title bar. The main, visual content of the HTML document is contained within <body> tags. Note that with HTML version 4.0 most attributes of the <body> tag have been deprecated in favor of specifying the attributes as styles. In previous version Of HTML, you could specify a bevy of options, including the document background, text and link colors. The onload and onunload attributes of the <body> tag, as well as global attributes such as style, are still valid. However, you should specify the other attributes in styles instead of within the <body> tag, such as in the following example: 12 <html> <head> <title> Document Title</title> <style type=”text/css”> Body {background:black; color:white} a: link {color: red} a: visited {color: blue} a: active {color: yellow} </style> </head> <body> … document body … </body> </html> The Head Element The head element contains general information, also called meta-information, about a document. Meta means “information about”. You can say that meta-data means information; also called meta-information means information about information. Information inside the Head Element The elements inside the head element should not be displayed by a browser According to the HTML standard, only a few tags are legal inside the head section. These are: <base>, <link>, <meta>, <title>, <style>, and <script>. Look at the following illegal construct:
  • 13. 13 In this case the browser has two options: · Display the text because it is inside a paragraph element · Hide the text because it is inside a head element If you put an HTML element like <h1> or <p> inside a head element like this, most browser will display it, even if it is illegal. Should browser forgive you for errors like this? We don’t think so. Others do. Head Tags Tag Description <head> Defines information about the Document <title> Defines the document title <base> Defines a base URL for all The links on a page <link> Defines a resource reference <meta> Defines meta information Tag Description <!DOCTYPE> Defines the document type. This tag goes before the <html> start tag, Headings HTML has six predefined heading tags. Heading use <h> tags containing the number of the heading. The <h1> tag specifies the highest (most important) level of headings, while <h6> specifies the lowest (least important) level of headings. As with most textual documents, HTML documents use larger fonts to specify higher- level headings. For example consider the following example and its output, <html> <head> <p>This is some text</p> </head>
  • 14. 14 <head> <title> Heading Tags </title> </head> <body> <h1> Heading Level 1</h1> <h2>Heading Level 2</h2> <h3>Heading Level 3</h3> <h4>Heading Level 4</h4> <h5>Heading Level 5</h5> <h6>Heading Level 6</h6> <p>Normal body text.</p> </body> </html> Headings are defined with the <h1> to <h6> tags. <h1>defines the largest heading. <h6> defines the smallest heading. <h1>This is a heading</h1> <h2> This is a heading</h2> <h3> This is a heading</h3> <h4> This is a heading</h4> <h5> This is a heading</h5> <h6> This is a heading</h6> HTML automatically adds an extra blank line before and after a heading,
  • 15. 15 Paragraphs Paragraphs are defined with the <p> tag. <p>This is a paragraph</p> <p>This is another paragraph</p> HTML automatically adds an extra blank line before and after a paragraph Don’t Forget the Closing Tag . You might have mnoticed that paragraphs can be written without end tags </p> : <p>this is a paragraph <p>This is another paragraph The example above will work in most browsers, but don’t rely on it. Future version of HTML will not allow you to skip ANY end tags. Closing all HTML elements with an end tag is a future proof way of writing HTML. It also makes the code easier to understand (read and browse) when you to mark both where an element starts and where it ends. Line Breaks The <br> tag is used which you want to break a line, but don’t want to start a new paragraph. The <br> tag forces a line break wherever you place it. <p> This <br>> is a para<br>graph with line breaks</p> Try it yourself The <br> Tag is an empty tag. It has no end tag like </br>, since a closing tag doesn’t make any sense. <br> or <br/> More and more often you will see the <nr> tag written like this: <br/> Because the <br>tag has on end tag (or closing tag), it breaks one of he rules for future HTML (the XML based XHTML), namely that all elements must be closed. Writing it like <br/> is a future proof way of closing <or ending> the tag inside the opening tag, accepted by both HTML and XML. Comments in HTML
  • 16. The comment tag is used to insert a comment in the HTML source code. A comment will be ignored by the browser. You can use comments to explain your code, which can help you when you edit the source code at a later dare. 16 <! -- This is a comment-- > Note that you need an exclamation point after the opening bracket, but not before the closing bracket. Recap on HTML Elements · Each HTML element has an element mane (body,h1,p,br) · The start tag is the name surrounded by angle brackets: <h1> · The end tag is a slash and the name surrounded by angle brackets </h1> · The element content occurs between the start tag and the end tag · Some HTML elements have on content · Some HTML elements have no end tag Basic Notes – Useful Tips When you write HTML text, you can never be sure how the text is displayed in another browser. Some people have large computer displays, some have small. The text will be reformatted every time the user resizes his window. HTML will truncate the spaces in your text. Any number of spaces counts as one. Some extra information: In HTML a new line counts as one space. Using empty paragraphs <p> to insert blank lines is a bad habit. Use the <br> tag instead. (But don’t use the <br> tag to create lists. Wait until you have learned about HTML lists.) HTML automatically adds an extra blank line before and after some elements, like before and after a paragraph, and before and after a heading. We use a horizontal rule (the <hr> tag), to separate the sections in out tutorials. Basic HTML Tags If you lookup the basic HTML tags in the reference below, you will see that the reference contains additional information about tag attributes. You will learn more about HTML tag attributes in the next chapter of this tutorial. Tag Description
  • 17. 17 <html> Defines an HTML document <body> Defines the document’s body <h1> to </h6> Defines header 1 to header 6 <p> Defines a paragraph <br> Inserts a single line break <hr> Defines a horizontal rule <!--> Defines a comment Horizontal Rules Horizontal rules are used to visually break up sections of a document. The <hr> tag creates a line from the current position in the document to the right margin and breaks the line accordingly. For example, if you were reproducing text from a book, you might want to use rules to show a break between chapters, as shown in the following excerpt from Anna Sewell’s Black Beauty: <! DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” http://www.w3.org/TR/html4/strict.dtd> <html> <head> <title> Excerpt of Black Beauty </title> </head> <body> <p>One day he was at this game, and did not know that the master was in the next field; but he was there., watching what was going on; over the hedge he jumped in a snap, and catching Dick by the arm, he gave him such a box in the ear as made him roar with the pain and surprise. As soon as we saw the master we trotted up nearer to see what went on. </p> <p> “Bad boy!” he said, “bad boy! To chase the colts. This is not the first time, nor he second, nut it shall be the last. There—take your money and go home; I shall not want you on my farm again. ”</p> <p> so we never saw Dick any more. Old Daniel, the men who looked after the horses, was just as gentle as our master, so we were well off. </p> <hr> <p>Chapter 02 The Hunt</p> <p>Before I was two years old a circumstance happened which I have never forgotten. It was
  • 18. early in the spring; there had been a little frost in the night, and a light mist still hung over the woods and meadows. I and the other colts were feeding at the lower part of the field when we heard, quite … </p> 18 </body> </html> As with most tags, you can customize the look of the <hr> tag by using Styles. For example, consider the following style: <style type=”text/css”> Hr {color: red; height: 5px; width: 50%;} <style> If this style were added to our last example. The results would be similar to the output shown in Figure
  • 19. 19 HTML Attributes Attributes provide additional information to an HTML element. HTML Tag Attributes HTML tags can have attributes. Attributes provide additional information to an HTML element. Attributes always come in name/ value pairs like this: name =”value”. Attributes are always specified in the start tag of an HTML element. Attributes Example 1: <h1>defines the start of a heading. <h1 align= center”> has additional information about the alignment. Attributes Example 2: <body> defines the body of an HTML document. <body bgcolor=”yellow”> has additional information about the background color.
  • 20. 20 Attributes Example 3: <table> defines an HTML table. (You will learn more about HTML tables later) <table border+”1”> has additional information about the border around the table Use Lowercase Attributes Attributes and attribute values are case-insensitive. However, the World Wide Web Consortium (W3C) recommends lowercase attributes/attribute values in their HTML 4 recommendation, and XHTML demands lowercase attributes/attribute values. Always Quote Attribute Values Attribute values should always be enclosed in quotes. Double style quotes are the most common, but single style quotes are also allowed. In some rare situations, like when the attribute values itself contains quotes, it is necessary to use single quotes: name= ‘John “ShotGun” Nelson’ HTML Text Formatting HTML defines a lot of elements for formatting output’ like bold or italic text. Text Formatting Tags Tag Description <b> Defines bold text <big> Defines big text <em> Defines emphasized text <i> Defines italic text <small> Defines small text <strong> Defines strong text <sub> Defines subscripted text <sup> Defines superscripted text <ins> Defines inserted text <del> Defines deleted text <s> Deprecated. Use <del> instead <strike> Deprecated. Use <del> instead <u> Deprecated. Use styles instead
  • 21. 21 “Computer Output” Tags Tag Description <code> Defines computer code text <kbd> Defines keyboard text <samp> Defines sample computer cods <tt> Defines teletype text <var> Defines a variable <pre> Defines preformatted text <listing> Deprecated. Use <pre> instead <plaintext> Deprecated. Use <pre> instead <xmp> Deprecated. Use <pre> instead Citations, Quotations, and Definition Tags Tag Description <abbr> Defines an abbreviation <acronym> Defines an acronym <address> Defines an address element <bdo> Defines the text direction <blockquote> Defines a long quotation <q> Defines a short quotation <cite> Defines a citation <dfn> Defines a definition term Inserting texts, Images HTML can also specify certain formatting to be applied to the text content of the web page. · Font formatting Font Face: Default, Arial, Courier, Time New Roman. Size: -3,-2,-1, default, +1, +2, +3 Colour: Default, Black, Red, Green, Blue Style formatting: Bold Italic Strong Emphasis Code
  • 22. The text formatting effects used above can be combined, as shown in the 22 following example: Text formatting effects can be combined by using nested HTML tags Text can also be formatted to become a hypertext link to another web page, document or resource. This is described on the following page. For images, HTML can be used to specify the image file to be included, the size (in pixels) at which the image should be displayed by the browser and how the image should be ‘wrapped’ around the surrounding text. In addition, images can be made into hyperlinks to other internet resources. A text alternative that will be displayed if the image fails to load should also be provided. How to View HTML Source Have you ever seen a Web page and wondered “Hey! How did they do that?” To find out, click the VIEW option in your browser’s toolbar and select SOUTCE to PAGE SOURCE. This will open a window that shows you the HTML code of the page.
  • 23. 23 HTML Entities and Links Chapter HTML Character Entities Some characters like the < character, have a special meaning in HTML, and therefore cannot be used in the text. To display a les than sign (<) in HTML, we have to use a character entity. Character Entities Some characters have a special meaning in HTML, like the less than sign (<) that defines the start of an HTML tag. If we want the browser to actually display these characters we must insert character entities in the HTML source. A character entity has three parts: an ampersand (&), an entity name or# and an entity number, and finally a semicolon (;). To display a less than sign in an HTML document we must write: &it; or &#60; The advantage; of using a name instead of a number is that a name is easier to; remember. The disadvantage is that not all browsers support the newest entity names, while the support for entity numbers is very good in almost all browsers. Note that the entities are case sensitive. Non-breaking space The most common character entity in HTML is the non-breaking space. Normally HTML will truncate spaces in your text. If you write 10 spaces in your text HTML will remove 9 of them. To add spaces to your text, use the &nbsp; character entity. The Most Common Character Entities: 3
  • 24. Result Description Entity Name Entity Number 24 Non-breaking space &nbsp; &#160; < less than &it; &#60; > Greater than &gt; &#62 & Ampersand &amp; &#38; “ Quotation mark &quot; &#34; ‘ Apostrophe &apos;(does Not work in IE) &#39; Some Other Commonly Used Character Entities: Result Description Entity Name Entity Number ¢ Cent &Cent &#160; £ Pound &Pound &#163; ¥ Yen &Yen &#165; € Euro &Euro &#8364; § Section &Section &#167; © Copyright &Copyright &#169 ® Registered Trademark &Registered Trademark &#174; × Multiplication &Multiplication &#215 ÷ division &Division &#247 Some Other Commonly Used Character Entities: Result Description Entity Name Entity Number ¢ Cent &Cent &#160; £ Pound &Pound &#163; ¥ Yen &Yen &#165; € Euro &Euro &#8364; § Section &Section &#167; © Copyright &Copyright &#169 ® Registered Trademark &Registered Trademark &#174; × Multiplication &Multiplication &#215 ÷ division &Division &#247 HTML Links
  • 25. 25 HTML uses a hyperlink to link to another document on the web. Hyperlinks are what make using the web so easy. By using HTML tags to embed the instructions on where other resources are located on the internet and how to access them, resources can be retrieved from anywhere on the internet by simply clicking on a link. Although HTML was initially developed as a hypertext system, in which the instructions were embedded within the text of a web page, hyperlinks can now be embedded within forms of media, including images, videos and animation. The Anchor Tag and the Href Attribute HTML uses the <a> (anchor) tag to create a link to another document. An anchor can point to any resource on the web: an HTML page, an image, a sound file, a movie, etc. The syntax of creating an anchor: <a href=”url”> Text to be displayed</a> The <a> tag is used to create an anchor to link from, the href attribute is used to address the document to link to, and the words between the open and close of the anchor tab will be displayed as a hyperlink. This anchor defines a link to Rgcsm: <a href=http://www.rgcsm.org/”> Visit RGCSM!</a> The line above will look like this in a browser. Visit RGCSM The Target Attribute With the target attribute, you can define where the linked document will be opened. The line below will open the document in a new browser window : <a href=http://www.rgcsm.org/ “ target =”_blank”>Visit Rgcsm! </a> The Anchor Tag and the Name Attribute The name attribute is used to create a named anchor. When using named anchors we can create links that can jump directly into a specific section on a page, instead of letting the user scroll around to find what he/she is looking for,
  • 26. Below is the syntax of a named anchor: <a mane=”label”> Text to be displayed </a> The name attribute is used to create a named anchor. The name of the anchor can be 26 any text you care to use. You should notice that a named anchor is not displayed in a special way. To link directly to the “tips” section, add a # sign and the name of the anchor to the end of a URL. Like this: <a href=”http://www.rgcsm.org/html _links.asp#tips”> Jump to the Useful Tips Section</a> A hyperlink to the Useful Tips Section from WITHIN the file “htnl_links.asp” will look like this: <a href=”#tips”> Jump to the Useful Tips Section </a> Basic Notes – Useful Tips Always add a trailing slash to subfolder references. Of you link like this: href =”http://www.rgcsm.org/html”, you will generate two HTTP requests to the serve, because the server will add a slash to the address and create a new request like this: href=”http:www.rgcsm.org/html/”, Named anchors are often used to create “table of contents” at the beginning of a large document. Each chapter within the document is given a named anchor, and links to each of these anchors are put at the top of the document. If a browser cannot find a named anchor that has been specified, it goes to the top of the document. No error occurs.
  • 27. 27 HTML Frames, Tables and List Chapter 4 HTML Frames With frames, you can display more than one Web page in the same browser window. The intelligent use of frames can give your pages a cleaner look and make them easier to navigate. Dividing a page into frames is actually quite simple. The basic concept goes like this: Each frame is a regular, complete html document. If you wanted to divide your page into 2 side by side frames, then you would put one complete html document in the left frame and another complete html document in the right frame, in addition you need to write a third html document. This MASTER PAGE (I’m coining a new phrase here folks ) contains the <FRAMS> tags that specify what goes where. As a matter of fact, that’s its only function. Frames With frames, you can display more than one HTML document in the same browser window. Each HTML document is called a frame, and each frame is independent of the others. The disadvantages of using frames are: · The web developer must keep track of more HTML documents. · It is difficult to print the entire page. The Frameset Tag · The <frameset> tag defines how to divide the window into frames · Each frameset defines a set of rows or columns · The values of the rows/columns indicate the amount of screen area each row/column will occupy. The Frametag The <frame> tag defines what HTML document to put into each frame
  • 28. In the example below we have a frameset with two columns. The first column is set to 25% of the width of the browser window. The second column is set to 75% of the width of the browser window. The HTML document “frame_a.htm” is put into the first column, and the HTML document “frame_b.htm” is put into the second column: Tag Description <frameset> Defines a set frames <frame> Defines a sub window (a frame) <noframes> Defines a noframe section for browsers 28 <frameset cols=”25%,75%”> <frame src=”frame_a.htm”> <frame src=”frame_b.htm”> </frameset> Note: The frameset column size value can also be set in pixels (cols=”200,500”), and one of the columns can be set to use the remaining space (cols=”25%,*”) Basic Notes – Useful Tips If a frame has visible borders, the user can resize it by dragging the border. To prevent a user from doing this, you can add noresize=”noresize” to the <frame> tag. Add the <noframes> tag for browsers that do not support frames. that do not handle frames <iframe> Defines an inline sub window (frame) Important: You cannot use the <body></body> tags together with the <frameset> </frameset> tags! However, if you add a <noframes> tag containing some text for browsers that do not support frames, you will have to enclose the text in <body></body> tags! See how it is done in the first example below. Frame Tags First things first. For this tutorial we will need a few html documents. Fire up Notepad and copy the following to get you started. <HTML> <HEAD> <TITLE>My Frame Page</TITLE> </HEAD>
  • 29. 29 <BODY> </BODY> </HTML> We will give each document a name. In Table Tutor and Form Tutor we used guy’s names. I think its time to get some young ladies in here. <HTML> <HEAD> <TITLE>My Frame Page </TITLE> </HEAD> <BODY> Lisa </BODY> </HTML> Create a new folder somewhere and save this as lisa.html. Now make another html document. <HTML> <HEAD> <TITLE> My Frame Page</TITLE> </HEAD> <BODY> Terri </BODY> </HTML> Save this in the same folder as terri.html. Now do the same for Kim, Tina, Shannon, and Beth. Save them just like the others. You should now have a folder that contains 6 complete standalone html documents. Ok, now the fun stuff…making your master page. Start with this. <HTML> <HEAD> <TITLE> My Frame Page-The Master Page</TITLE> </HEAD> <BODY> </BODY> </HTML> Remove the </BODY> tags. The master page doesn’t use them……
  • 30. 30 <HTML> <HEAD> <TITLE>My Frame Page-The Master Page</TITLE> </HEAD> </HRML> …..it uses <FRAMEST> tags instead. <HTML> <HEAD> <TITLE>My Frame Page-The Master Page</TITLE> </HEAD> <FRAMESET> </FRAMESET> </HTML> To keep things a little cleaner, I’m going to stop0 writing the <HTML>, <HEAD> and <TITLE> tags. Needless to say, keep them in your document. <FRAMESET> </FRAMESET> Now’s a good time to save it. Save it in your folder (with all the girls) as index.html. If you try to open it with your browser now it will be blank. All you have said so far is “This is my Master Page”. Now let’s start defining just how things are going to look. Tell the browser to split the main window into 2 columns, each occupying 5% of the window. <FRAMESET COLS=”50%, 50%”> </FRAMESET> This will still be blank, we have one more thing to do before our ‘system is operational”. We must tell the browser what to put in each frame. <FRAMESETS COLS=”50%,50%”> <FRAME SCR=”lisa.html”> <FRAME SRC=”terri.html”> </FRAMESET>
  • 31. 31 You are now the proud parent of a fully functional Framed page! One last thing before we go on. Note that <FRAMESET> is a container tag, and <FRAME>is not. For those that don’t know what that means, a container tag has an opening <TAG> and a closing </TAG>. With the form tag you can add to your web pages a guestbook, order forms, surveys, get feedback or whatever. The basic construction of a html from is this………… <FROM> begin a form <INPIT> ask for information in one of several different ways... <INPUT> …there can be as many input areas as you wish </FORM> end a form That’s html forms in a nutshell. You are now ready to make some forms! Now’s a good time to stress that if you want to learn how to make quality html documents, them you would be well served to take the time to teach yourself the tags. If you rely on the so-called “from wizards” in the “easy as pie html editors” out there, you will have greatly limited flexibility, and the end result may not be what you are trying to achieve. In my opinion the best html editors to use are text based editors. A few good ones that come to mind are listed here. These editors will make your html coding easier. They don’t attempt to do it for you. Just like “follow the bouncing ball”, I want you to open up Notepad (Yes, Notepad!) and follow me. Copy and paste off this page the following to get you started: <HTML> <HEAD> <TITLE> Joe’s the handsomest guy I know </TITLE> </HEAD> </BODY> <FORM> </FROM> </BODY> </HTML> Next we must tell the browser where to send the data we gather and how to send it. There are two basic things you can do. 1) You can send the data to a CGI script for processing. The parsed data is then emailed to you. This is the preferred method, or 2) You can have the data emailed directly to you using the mailto action. This is simpler but less reliable. For the sake of simplicity, we will start with the second method. <HTML>
  • 32. <HEAD> <TITLE> Joe’s the handsomest guy I know </TITLE> </HEAD> <BODY> <FROM METHOD= POST ACTION=”mailto: xxx@xxx.xxx” 32 ENCTYPE=”text/plain”> </FROM> </BODY> </HTML> The only thing you have to do is plug in your email address after mailto: To send the data to more than one email address, separate them with commas… larry@3stooges.org,curly@3stooges.org,mo@3stooges.org Now, I said that this method is simple, but not entirely reliable. For the time being, it is perfectly OK to use this method as you work through the tutorial. As you complete the lessons you can practice sending yourself information. For most people, under most circumstances, everything will be just fine. If you’d like, you can skip the rest of this lesson for now and dive right into making forms. After you learn a little about forms (or if you’re having trouble submitting them), definitely come back here and learn more about form processing. Every so often, depending on the sender’s browser/email configuration, using the mailto action might just bring up an empty New Mail window instead of sending the form data. Sometimes (rarely) you’ll click on the button and nothing will happen. in this case you will not be able to even practice with the simpler mailto action. You will have to straight into using a CGI form handler to practice with. Before we into that, there is one more thing about the mailto action that I want to mention. Sometimes, depending on the person sending the data, you will receive the data in a very strange format. Instead of something nice & neat like this…….. FORMNAME=New Entrant NAME=R.U. Havinfun ADDRESS=13`3 Mockingbird Lane CITY=Beverly Hills STATE=CA The info comes back looking like this….. FROMNAME=New+Entrant&NAME=R.U. +Havinfun&ADDRESS=1313 +Mockingbird+Lane&CTTY+Beverly+Hills&STATE=CA HTML Tables With HTML you can create tables.
  • 33. 33 Tables Tables are defined with the <table>tag. A table is divided into rows (with the <tr> tag), and each row is divided into data cells (with the <td> tag). The letters td stands for “table data,” which is the content of a data cell. A data cell can contain text, images, lists, paragraphs, forms, horizontal rules, tables, etc <table border=”1”> <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> How it looks in a browser: row 1, cell 1 row 1, cell 2 row 1, cell 2 row 2, cell 2 Tables and the Border Attribute If you do not specify a border attribute the table will be displayed without any border sometimes this can be useful, but most of the time, you want the borders to show. To display a table with borders, you will have to use the border attribute :< table border=”1”> <TR> <td>Row 1, cell 1</td> <td>Row 2, cell 2</td> </tr> </table> Headings in a table Headings in table are defined with the <th> tag. <table border=”1”>
  • 34. 34 <tr> <th>Heading</th> <th>Another Heading</th> </tr> <tr> <td>row 1, cell 1</td> <td> row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td>row 2, cell 2</td> </tr> </table> How it looks in a browser Heading Another Heading row 1, cell 1 row 1, cell 1 row 1, cell 2 row 1, cell 2 Empty Cells in a Table Table cells with no content are not displayed very well in most browsers.<table border=”1” <tr> <td>row 1, cell 1</td> <td> row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td></td> </tr> </table> How it looks in a browser: row 1, cell 1 row 1, cell 2 row 2, cell 1
  • 35. Note that the borders around the empty table cell are missing (NB! Mozilla Firefox 35 displays the border). To avoid this, add a non-breaking space (&nbsp;) to empty data cells, to make the borders visible: <table border=”1”> <tr> <td>row 1, cell 1</td> <td> row 1, cell 2</td> </tr> <tr> <td>row 2, cell 1</td> <td> &nbsp ;< /td> </tr> </table> How it looks in a browser: row 1, cell 1 row 1, cell 2 row 2, cell 1 Basic Notes – Useful Tips The <thead>, <tbody> and <tfoot> elements are seldom used, because of bad browser support. Expect this to change in future versions of XHTML. Table Tags Tag description <table> Defines a table <th> Defines a table header <tr> Defines a table row <td> Defines a table cell <caption> Defines a table caption <colgroup> Defines groups of table column <col> Defines the attribute values for one or more columns in a table <thead> Defines a table head <tbody> Defines a table body
  • 36. 36 <tfoot> Defines a table footer HTML Lists HTML supports ordered, unordered and definition lists. Unordered Lists An unordered list is a list of items. The list items are marked with bullets (typically small black circles). An unordered list starts with the <ul> tag. Each list item starts with the <li> tag. <ul> <li>Coffee</li> <li>Milk</li> M/ul> Here is how it looks in a browser: · Coffee · Milk Inside a list item you can put paragraphs, line breaks, images, links, other lists, and. example: <html> <head> <title>Example Unordered List with Image Bullets</title> </head> <body> <p> <b>sphere</b></p> <ul style=”list-style-image: url<sphere.jpg);”> <li>Vanilla<l/i> <li>Chocolate</li> <li>Strawberry</li> </ul> <p> <b>cone</b></p> <ul style=”list-style-image: url<cone.jpg);”> <li>Vanilla<l/i> <li>Chocolate</li> <li>Strawberry</li> </ul> </body> </html>
  • 37. 37 Ordered Lists An ordered list is also a list of items. The list items are marked with numbers. An ordered list starts with the <ol> tag. Each list item starts with the <li> tag. <ol> <li>Coffee<li> <li>Milk</li> </ol> Here is how it looks in a browser: 1. Coffee 2. Milk Inside a list item you can put paragraphs, line breaks, images, links, other lists, etc. Definition Lists A definition list is not a list of items. This is a list of terms and explanation of the terms. A definition list starts with the <dl>tag. Each definition- list term starts with the <dt>tag. Each definition-list definition starts with the <dd> tag. <dl>
  • 38. 38 <dt>Coffee</dt> <dd>Black hot drink</d> <dt>Milk</dt> <dd>White cold drink</dd> </dl> Here is how it looks in a browser: Coffee Black hot drink Milk White cold drink Inside a definition-list definition (the<dd>tag) you can put paragraphs, line breaks, images, links, other lists, etc. List Tags Tag Description <ol> Defines an ordered lilt <ul> Defines an unordered list <li> Defines a list item <dl> Defines a definition list <dt> Defines a definition term <dd> Defines a definition description <dir> Deprecated. Use <ul> instead <menu> Deprecated. Use <ul> instead Examples of Lists: <HTML> <HEAD><TITLE>Lists</TITLE><HEAD> <BODY> // <B>Example on Unordered List</B> // <UL TYPE=FILLROUND> <LI>Sportstar <LI>Business Week <LI>Time </UL> // <B>Example on Ordered List</B> // <OL TYPE=”I”START=4>
  • 39. 39 <LI>Sportstar <LI>Business Week <LI>Time </OL> // <B>Example on Definition List</B> // <DL> <DT>Sports Magazine<DD>Sportstar <DT>Business Magazine<DD>Business Week <DT>General Magazine<DD>Time </DL> </BODY> </HTML> Nested Lists You can nest lists of the same or different types. For example, suppose you have a bulleted list and need a numbered list beneath one of the items, as shown: ? Send us a letter detailing the problem. But sure to include the following: 1. Your name 2. Your order number 3. Your contact information 4. A detailed description of the problem In such a case, you would nest an ordered list inside an unordered one, as shown in the following code: <!DOCTYPE HTML PUBLIC “_//W3C//DTD HTML 4.01//EN” http://www.w3.org/TR/html4/strict.dtd”> <html> <head> <title>Example Definition List </title> </head> <body> <ul style=”list-style: disc ;”> <li>Send us a letter detailing the problem. Be sure to Include the following :< /li> <ol style=”list-style: decimal ;”> <li>Your name.</li> <li>Your order number. </li> <li>Your contact information. </li>
  • 40. 40 <li>A detailed description of the problem.</li> </ol> </ul> </body> </html> The output of the code is shown in Figure Figure: you can nest different types of lists within one another. Note that the nested list does not span any open or close tags-it starts after the close tag of the parent’s item and before any other tags in the parent list. It is also formatted (indented) to make it easier to identify in the code. Using this method, you can nest any list within any other list. Changing the Start Value of Ordered Lists Previous versions of HTML allowed the use of the start attribute in the <ol> tag to control what number or letter the list began with. For example, the following code starts a list with the decimal number 12: <ol start=”12” style=”list-style: decimal ;”> However, the start attribute of the <ol> tag was deprecated, and a replacement CSS style has yet to be defined. Although you can use the start attribute, your document will no longer validate against strict HTML.
  • 41. If you find yourself needing consistent, yet flexible numbering, consider using the new CSS2 automatic counters and numbering feature. This feature user the content property along with the new counter-increment and counter-reset properties to provide a flexible yet powerful automatic counter function. The following style code will define a counter and cause any <ol> list to begin with 41 an item number of 12: <style type=”text/css”> ol {counter-reset: list 11 :} li {list-style-type: none ;} li: before { Content: counter (list, decimal)”.”; counter-increment: list ;} </style> This code introduces quite a few CSS2 concepts-pseudo-elements, counters, and relates properties and methods. However, it isn’t as complex as it might first appear:? · The ol definition causes the counter (list) to be reset to 11 every time the <ol> tag is use-that is, at the beginning of every ordered list? · The li definition sets the list style type to none-the counter will display our number, if we left the list style type set to decimal, there would be an additional number with each item.? · The li: before definition does two things: 1) causes the counter to be displayed before the item (using the begin pseudo-element and the content property) along with a period and a space; 2) increments the counter. Note that the counter increment happens first, before the display. That is the reason you need to reset the counter to one lower than your desired start. Using the preceding styles along with the following list code in a document results in a list with items numbered 12-15: <ol> <li>item 12</li> <li>item 12</li> <li>item 12</li> <li>item 12</li> </ol> Counters are a new, powerful feature of CSS2.Unfortunately, at the time of this writing, only the Opera browser fully supports counters. However, the other browsers are sure to follow suit. You’ll find more information on counters and the content property in chapter 16. Tip
  • 42. The various list properties can all be defined without one property, list-style. The list-style property has the following syntax: 42 list-style: <list-style-type> <list-style-image> <list-style-position> You can use this one property to specify one, two, or all three list-style properties in one declaration. For example, to define an ordered list with lowercase letters and inside positioning, you could use the following tag: <ol style=”list-style: lower-alpha inside ;”> See Chapters 16 and 17 for more information on styles.
  • 43. 43 HTML Forms and Input Chapter HTML Forms are used to select different kinds of user input. Forms A form is an area that can contain form elements. Form elements are elements that allow the user to enter information (like text fields, text area fields, drop-down menus, radio buttons, checkboxes, etc.) in a form. A form is defined with the <form> tag. <form> <input> <input> </form> Input The most used form tag is the <input> tag. The type of input is specified with the type attribute. The most commonly used input typed is explained below. Text Fields Text fields ate used when you want the user to type letters, numbers, etc. in a form. <form> First name: <input type=”text” name=”firstname> <br> Last name:] <input type=”text” name=”lastname”> </form> How it looks in a browser: 5
  • 44. 44 First name: Last name: Note that the form itself is not visible. Also note that in most browsers, the width of the text field is 20 characters by default. Radio Buttons Radio Buttons are used when you want the user to select one of a limited number of choices. <form> <input type=”radio” name=”sex” value=”male”> Male <br> <input type=”radio” name=”sex” value=”female”> Female </from> How it looks in a browser: Male Female Note that only one option can be chosen. Checkboxes Checkboxes are used when you want the user to select one or more options of a limited number of choices. <form> I have a bike: <input type=”checkbox” name=”vehicle” value=”Bike”> <br> I have a car: <input type=”checkbox” name=”vehicle” value=”Car”> <br> I have an airplane: <input type=”checkbox” name=”vehicle” value=”Airplane”> </from> How it looks in a browser: I have a bike:
  • 45. 45 I have a car: I have an airplane: The form’s Action Attribute and the Submit Button When the user clicks on the “Submit” button, the content of the form is sent to another file. The form’s action attribute defines the name of the file to send the content to. The file defined in the action attribute usually does something with the received input. <form name =”input” action=”html_form_action.asp” method=”get”> username: <input type=”text” name=”user”> <input type=”submit” value=”submit”> </form> How it looks in a browser Username: submit If you type some characters in the text field above, and click the “submit” button, you will send your input to a page called “html_form_action.asp”. The page will show you the received input . Form Tags Tag Description <form> Defines a form for user input <input> Defines an input field <textarea> Defines a text-area (a multi Line text input control) <label> Defines a label to a control <fieldset> Defines a fieldset <legend> Defines a caption for a field Set <select> Defines a selectable list (a
  • 46. 46 Drop-down box) <optgroup> Defines an option group <option> Defines an option in the drop-down box <button> Defines a push button <isindex> Deprecated. Use <input> instead
  • 47. HTML Images and Colors 47 Chapter HTML Images With HTML you can display images in a document. The Image Tag and the Src Attribute In HTML, images are defined with the <img> tag. The <img> tag is empty, which means that it contains attributes only and it has no closing tag. To display an image on a page, you need to use src attribute. Src stands for “source”. The value of the sre attribute is the URL of the image you want to display on your page. The syntax of defining an image: <img src=”url”> The URL points to the location where the image is stored. An image named “boat.gif” located in the directory “images” on www.rgcsm.org” has the URL :http://www.rgcsm.org/images/boat.gif. The browser puts the image where the image tag occurs in the document. If you put an image tag between two paragraphs, the browser shows the first paragraph, then the image, and then the second paragraph. Example: <HTML> <HEAD><TITLE> Working with Images </TITLE></HEAD><BODY Background=”images/textural.gif “> <B>Controlling Image Borders! </B><CENTER> <I>Image without a BORDER </I><BR><BR> <IMG Src = “images/corp.gif”><BR><BR> <I> Image With BORDER =3</I><BR><BR> 6
  • 48. 48 <IMG Border=3 src=”images/corp./gif”><BR> </CENTER> </BODY> </HTML> The Alt Attribute The alt attribute is used to define an “alternate text” for am image. The value of the alt attribute is an author-defined text: <img src=”boat.gif” alt=”Big Boat”> The “alt” attribute tells the reader what he or she is missing on a page if the browser can’t load images. The browser will then display the alternate text instead of the image. It is a good practice to include the “alt” attribute for each image on a page, to improve the display and usefulness of you document for people who have text-only browsers. Example: <HTML> <HEAD><TITLE> Working with Images </TITLE></HEAD> <BODY Background=”images/textural.gif”> <B> Use of ALT attribute</B><BR><CENTER> <I>Available Image: javacup.gif</I><BR><BR> <IMG Src=”images/javacup.gif”><BR><BR> <I>Unavailable Image: javac.gif - Without the ALT Attribute </I><BR><BR> <IMG>Src=”images/javac.gif”><BR><BR> <I>Unavailable Image: javac.gif – With the ALT Attribute set to “Java”</I><BR><BR> <IMG Alt=”The Java Cup” Src=”images/javac.gif”><BR> </CENTER> </BODY> </HTML> Basic Notes – Useful Tips If an HTML file contains ten images – eleven file are required to display the page right. Loading images take time, so my best advice is: Use images carefully. Image Tags
  • 49. 49 Tag Description. <img> Defines an image <map> Defines an image map <area> Defines a clickable area inside an image map Example: Controlling image size: <HTML> <HEAD><TITLE> Working with Images </TITLE> </HEAD> <BODY Background =”images/textural.gif”> <B>Controlling Image Sizes! </B><CENTER> <I>Normal Image Size</I><BR><BR> <IMG Src=”images/computer.gif”>BR> <I>Image With Size <Height And Width) Set To200</I><BR><BR> <IMG Height =200 Src=”images/computer.gif Width=200><BR> </CENTER> </BODY> </HTML> Example: Setting image alignment <HTML> <HEAD><TITLE>Working with Image </TITLE> </HEAD> <BODY Background=”images/textural.gif”> <B><I> Image Aligned Left </I></B> <IMG Align=Left Src=”images/sctonly2.gif”><BR><BR> Silicon Chip Technologies, <BR> <I> We Specialize In Corporate Training, Software Development and Placements. Our Training Program and Software Development include Web Based Commercial Applications and Commercial Application Development using Database. </I> <BR> <BR> <BR> <BR> <B><I> Image Aligned Right </I></B> <IMG Align=Right Src=”images/sctonly2.gif”><BR><BR> Silicon Chip Technologies, <BR>
  • 50. <I> We Specialize In Corporate Training, Software Development And Placements. Our Training Program and Software Development include Web Based Commercial Applications and Commercial Application Development using Database. </I> 50 </BODY> </HTML> HTML Background A good background can make a Web site look really great. Backgrounds The <body>tag has two attributes where you can specify background. The background can be a color or an image. Bgcolor <HTML> <HEAD><TITLE>Working with Image </TITLE> </HEAD> <BODY Background=”images/textural.gif”> <B><I> Image Aligned Left </I></B> <IMG Align=Left Src=”images/sctonly2.gif”><BR><BR> Silicon Chip Technologies, <BR> <I> We Specialize In Corporate Training, Software Development And Placements. Our Training Program and Software Development include Web Based Commercial Applications and Commercial Application Development using Database. </I> <BR> <BR> <BR> <BR> <B><I> Image Aligned Right </I></B> <IMG Align=Right Src=”images/sctonly2.gif”><BR><BR> Silicon Chip Technologies, <BR> <I> We Specialize In Corporate Training, Software Development And Placements. Our Training Program and Software Development include Web Based Commercial Applications and Commercial Application Development using Database. </I> </BODY> </HTML>The value of this attribute can be a hexadecimal number, an RGB value, or a color name:
  • 51. 51 <body bgcolor=”#000000”> <body bgcolor=”rgb(0.0.0)”> <body bgcolor=”black”> The lines above all set the background-color to black. Background The background attribute specifies 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 until it fills the entire browser window. <body background=”clouds. gif”> <body background=http://www.rgcsm.org/clouds.gif”> The URL can be relative (as in the first line above) or absolute (as in the second line above). Note: If you want to use a background image, you should keep 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? Basic Notes – Useful Tips 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). HTML Colors Colors are displayed combining RED, GREEN, and BLUE light sources. Color Values
  • 52. HTML colors can be defined as a hexadecimal notation for the combination of Red, 52 Green, and Blue color values (RGB) The lowest value that can be given to one light source is 0 (hex#00) and the highest value is 255 (hex#FF). The table below shows the result of combining Red, Green, and Blue light sources W3C Color Color HEX Color RGB Standard Color Names #000000 rgb(0,0,0) #FF0000 rgb(,2550,0) #00FF00 rgb(0,255,0) #000FF0 rgb(0,0,255) #FFFF00 rgb(255,255,0) #00FFFF rgb(0,255,255) #FF00FF rgb(255,0,255) #COCOC0 rgb(192,192,192) #FFFFFF rgb(255,255,255) W3C has listed 16 color names that will validate with an HTML valuator. The color manes are: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, purple, red, silver, teal, white, and yellow. Cross-browser Color Values Some years ago, when most computers only supported 256 different colors, a list of 216 Web Safe Colors was suggested as a Web standard. The reason for this was that the Microsoft and Mac operating system used 40 different “reserved” fixed system colors (about 20 each). We are not sure how important this is now, since most computers today have the ability to display millions of different colors, but the choice is left to you. HTML Color Values Colors are displayed combining RED, GREEN, and BLUE light sources.
  • 53. 53 Color Values HTML colors are defined using a hexadecimal notation for the combination of RED, GREEN, and BLUE color values (RGB). The lowest value that can be given to one of the light sources is 0 (hex#00). The highest value is 255 (hex#FF). Turn Off the Red If you turn off the Red light completely, there are 65536 different combinations of Green and Blue (256*256) to experiment with. Click here to see some of these combinations of Green and Blue. Turn On the Red By setting the Red light completely, there are 65536 different combinations of Green and Blue (256*256) to experiment with. Click here to see some of these combinations of Green and Blue. 16 Million Different Colors The combination of Red, Green, and Blue values from 0 to 255 gives a total of core than 16 million different colors to play with (256*256*256). Most modern monitors are capable of display at least 16384 different colors.
  • 54. 54 HTML Layout fonts and Style Chapter 7 HTML Layout Everywhere on the Web you will find pages that are formatted like newspaper pages using HTML columns. HTML Layout – Using Tables One very common practice with HTML is to use HTML tables to format the layout of an HTML page. An HTML <table> is used to divide a part of Web page into two columns. The trick is to use a table without borders, and may be a little extra cell- padding. No matter how much text you add to page, it will stay inside its column borders. Example: Creating Table <HTML> <HEAD><TITLE>Table Attributes </TITLE> </HEAD> <BODY BGColor=LIGHTGREY> <B>Specifying the BORDER and WIDTH of the Table! </B><BR><BR><BR><BR> <CENTER><TABLE Borer=5 Width=50%> <CAPTION Align=Bottom><B>Personal Information </B> </CAPTION> <TR><TH>NAME</TH><TH>AGE</TH></TR> <TR Align=CENTER><TD>Shilpa</TD><TD>21</TD> </TR> <TR Align=CENTER><TD>Vaishali</TD><TD>22</TD> </TR> </TABLE><.CENTER> </BODY> </HTML>
  • 55. 55 HTML Fonts The <font> tag in HTML is deprecated. It is supposed to be removed in a future version of HTML. Even if a lot of people are using it, you should try to avoid it, and use styles instead. The HTML <font> Tag With HTML code like this, you can specify both the size and the type of the browser output <p> <font size=2”face=”Verdana”> This is a paragraph. </font> </p> <p> <font size=”3”face=”Times”> This is another paragraph. </font> <p> Font Attributes Attribute Example Purpose size=”number” size=”2” Defines the font size size=”+number” size=”=1” Increases the font size size=”-number” size=”-1” Decreases the font size face=”face-name” face=”Times” Defines the font-name color=”color-value” color=”#eeff00” Defines the font color color=”color-name” color=”red” Defines the font color The <font> Tag Should NOT be Used The <font> tag is deprecated in the latest versions of HTML (HTML 4 and XHTML).
  • 56. The World Wide Web Consortium (w3c) has removed the <font> tag from its recommend-dations. In future versions of HTML, style sheets (CSS) will be used to define the layout and display properties of HTML elements. HTML Styles With HTML 4.0 all formatting can be moved out of the HTML document and into 56 a separate style sheet. How to Use Styles When a browser reads a style sheet, it will format the document according to it. There are three ways of inserting a style sheet: External Style Sheet: An external style sheet is ideal when the style is applied to many pages. With an external style sheet, you can change the look to an entire Web site by changing one file. Each page must link to the style sheet using the <link> tag. The <link> tag goes inside the head section. <head> <link rel=”stylesheet” type=”text/css” Href=”mystyle.css”> </head> Internal Style Sheet An internal style sheet should be used when a single document has a unique style. You define internal style sheet in the head section with the <style> tag. Inline Style An internal style sheet should be used when a unique style is to applied to a single occurrence of an element. To use inline styles you use the style attribute in the relevant tag. The style attribute can contain any CSS property. The example shows how to change the color and the left margin of a paragraph:
  • 57. 57 <p style=”color: red; margin-left: 20px”> This is a paragraph </p> Style Tags Tag Description <style> Defines a style definition <link> Defines a resource reference <div> Defines a section in a document <span> Defines a section in a document <font> Deprecated. Use styles instead <basefont> Deprecated. Use styles instead <center> Deprecated. Use styles instead
  • 58. 58 HTML Advanced Chapter HTML Uniform Resource Locators 8 HTML Links When you click on a link in an HTML document like this: Last Page, an underlying <a> tag points to a place (an address) on the Web with an href attribute value like this: <a href=”lastpage.html”>Last page</a>. The Last Page link in the example is a link that is relative to the Web site that you are browsing, and your browser will construct a full Web address like http”//www.rgcsm.org/html/ last page .htm to access the page. Creating an Email Link Building an attractive, useful Web page is only part of the job. You also need to give viewers a way to contact you. In the digital age, Web users expect to have instant and easy email contact with you. To make a link to your email address, you’ll need to use the anchor tag again. You can separate you r email contact with the <HR> tag, which inserts a horizontal line. We’ve decided to have the email contact link centered on the page. Put it below the list, like this: <CENTER> <HR> <a href=mailto:comments@builder.com”>Drop us a line! </a> </CENTER> Uniform Resource Locators
  • 59. Something called a Uniform Resource Locator (URL) is used to address a document (or other dada) on the World Wide Web. A full Web address like this: http://www.rgcsm.org/jtml/lastpage. htm follows these syntax rules: 59 scheme://host.domain:port/path/filename The scheme is defining the type of Internet service. The most common type is http. The domain is defining the Internet domain name like rgcsm.org. The host is defining the domain host. If omitted, the default host for http is www. The: port is defining the port number at the host. The port number is normally omitted. The default port number for http is 80. The path is defining a path (a sub directory) at the server. If the path is normally omitted, the resource (the document) must be located at the root directory of the Web site. The filename is defining the name of a document. The default filename might be default.asp, or index.html or something else depending on the settings of the Web server. URL Schemes Some examples of the most common schemes can be found below: Schemes – Access file – a file on your local PC ftp – a file on an FTP server http – a file on a World Wide Web server gopher – a file on a Gopher server news – a Usenet newsgroup telnet – a Telnet connection WAIS – a file on a WAIS server Accessing a Newsgroup The following HTML code: <a href=news:alt.html>HTML Newsgroup</a> Creates a link to a newsgroup like this HTML Newsgroup. Downloading with FTP The following HTML code:
  • 60. 60 <a href=ftp://www.rgcsm.org/ftp/WinZip.exe>Download WinZip</a> Creates a link to download a file like this: Download WinZip. (The link doesn’t work. Don’t try it. It is just an example. W3C Schools doesn’t really have an ftp directory.) Link to your Mail system The following HTML code: <a href=mailto:someone@rgcsm.com”>someone@rgcsm. Com</a> Creates a link to your own mail system like this: Someone@rgcsm.com HTML Scripts Add scripts to HTML pages to make them more dynamic and interactive. Insert a Script into HTML Page A script in HTML is defined with the <script> tag. Note that you will have to use the type attribute to specify the scripting language. <html> <head> </head> <body> <script type=”text/javascript”> document. write (“Hello World!”) </script> </body> </html> The script above will produce this output: Hello World! How to Handle Older Browsers A browser that does not recognize the <script> tag at all, will display the <script> tag’s content as text on the page. To prevent the browser from doing this, you should hide the script in comment tags. An old browser (that does not recognize the <script> tag) will ignore the comment and it will not write the tag’s content on the page, while a new browser will understand that the script should be executed, even if it is surrounded by comment tags.
  • 61. 61 Example JavaScript: <script type=”text/javascript”> <!— document.write (“Hello World!”) //-- > </script> VBScript: <script type=”text/vbscript”> <!-- document.write(“Hello World!”) ‘-- > </script> The <noscript> Tag In addition to hiding the script inside a comment, you can also add a <noscript> tag. The <noscript> tag is used to define an alternate text if a script is NOT executed. This tag is used for browsers that recognize the <script> tag, but do not support the scrip0t inside, so these browsers will display the text inside the <noscript> tag instead. However, if a browser supports the script inside the <script> tag it will ignore the <noscript> tag. Example JavaScript: <script type=”text/javascript”> <!— document.write(“Hello World!”) //-- > </script> <noscript>Your browser does not support Java Script! </noscript> VBScript:
  • 62. 62 <script type=”text/vbscript”> <!-- document.write(“Hello World!”) ‘-- > </script> <noscript>Your browser does not support VBScript! </noscript> Script Tags Tag Description <script> Defines a script <noscript> Defines an alternate text if the script is not executed <object> Defines an embedded object <param> Defines run=time settings (parameters) for an object <applet> Deprecated. Use <object> instead The Meta Element As we explained in the previous chapter, the head element contains general information (meta-information) about a document. HTML also includes a meta element that goes inside the head element. The purpose of the meta element is to provide meta-information about the document. Most often the meta element is used to provide information that is relevant to browsers or search engines like describing the content of your document. Note: W3C states that “Some users agents support the use of META to refresh the current page after a specified number of seconds, with the option of replacing it by a different URL. Authors should not use this technique to forward users to different pages, as this makes the page inaccessible to some users. Instead, automatic page forwarding should be done using server-side redirects” Keywords for Search Engines Some search engines on the WWW will use the name and content attributes of the meta tag to index your pages.
  • 63. This meta element defines a description of your page: <meta name=”description” content=”Free Web tutorials on 63 HTML, CSS, XML, and XHTML”> This meta element defines keywords for your page: <meta name=”keywords” content=”HTML, DHTML, CSS, XML, XHTML, JavaScript, VBScript”> The intention of the name and content attributes is to describe the content of a page. However, since too many webmasters have used meta tags for spamming, like repeating keywords to give pages a higher ranking, some search engines have stopped using them entirely. Unknown Meta Attributes Sometimes you will see meta attributes that are unknown to you like this: <meta name=”security “content=”low”> Then you just have to accept that this is something unique to site or to the author of the site, and that it has probably no relevance to you. HTML 4.0 Standard Attributes HTML tags can have attributes. The special attributes for each tag are listed under each tag description. The attributes listed here are the core and language attributes that are standard for all tags (with a few exceptions): Core Attributes Not valid in base, head, html, meta, param, script, style, and title elements. Attribute Value Description class class_rule or style_rule The class of the element id id_name A unique id for the element
  • 64. style style_definition An inline style definition title tooltip_text A text to display in a tool tip 64 Language Attributes Not valid in base, br, frame, frameset, hr, iframe, param, and script elements Attribute Value Description dir ltr | rtl Sets the text direction lang language_code Sets the language code Keyboard Attributes Attribute Value Description accesskey character Sets a keyboard shortcut to access an element tabindex number Sets the tab order of an element HTML 4.0 Event Attributes New to HTML 4.0 is the ability to let HTML event trigger actions in the browser, like starting a JavaScript when a user clicks on an HTML element. Below is a list of attributes that can be inserted into HTML tags to define event actions. Window Events Only valid in body and frameset elements. Attribute value Description onload script Script to be run when a document loads onunload script Script to be run when a document unloads Form Element Events
  • 65. 65 Only valid in form elements. Attribute Value Description onchange script Script to be run when the element changes onsubmit script Script to be run when the form is submitted onresel script Script to be run when the form is resel onselect script Script to be run when the element is selected onblur script Script to be run when the element loses focus onfocus script Script to be run when the element gets focus Keyboard Events Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements. Attribute Value Description onkeydown script what to do when key is pressed onkeypress script what to do when key is pressed and released onkeyup script what to do when key is released Morse Events Not valid in base, bdo, br, frame, frameset, head, html, iframe, meta, param, script, style, and title elements. Attribute Value Description onclick script What to do on a mouse click ondblclick script What to do on a mouse double-click onmousedown script What to do on a mouse button is pressed onmousemove script What to do on a mouse pointer moves onmousout script What to do on a mouse pointer moves out of an
  • 66. 66 element onmousover script What to do on a mouse pointer moves over an element onmouseup script What to do on a mouse button is released Web Publishing Your First Step: A Personal Web Server · If you want other people to view your pages, you must publish them. · To publish your work, you have to copy your files to a web server. · Your own PC can act as a web server if it is connected to a network. · If you are running Windows 98, you can use the PWS (personal Web Server). · PWS is hiding in the PWS folder in your Windows CD. Personal Web Server (PWS) PWS turns any Windows computer into a Web server. PWS is easy to install and ideal for developing and testing Web application. PWS has been optimized for working use, but has all the requirements of a full Web server. It also runs Active Server Pages (ASP) just like its larger brother IIS. How to Install a Personal Web Server (PWS) Browser your Window installation to see if you have installed PWS. If not, install PWS from the PWS directory on your Window CD. Follow the instructions and get your personal Web Server up and running. Note: Microsoft Windows XP Home Edition does not come with the option to turn your computer into a PWS! Internet Information Server(IIS) Windows 2000’s built-in Web server IIS, makes it easy to build large applications for the Web. Both PWS and IIS include ASP, a server- side scripting standard that can be used to create dynamic, and interactive Web applications, IIS is also available for Windows NT. Your Next Step: A Professional Web Server · If you do not want to use PWS or IIS, you must upload your files to a public server. · Most Internet Service Providers (ISP’s) will offer to host your web pages.
  • 67. · If your employer has an Internet Server, you can ask him to host your Web 67 site. · If you are really serious about this, you should install your own Internet Server.
  • 68. Introduction to Dynamic HTML? Chapter Web authors today face significant challenges when making their Web pages 9 interactive. The static nature of HTML pages limits their creative choices, and interactive components can be difficult to build and reuse. In addition, using proprietary extensions means authoring browser-specify Web pages. Microsoft Dynamic HTML technology helps to remove these barriers for content providers and offers users more engaging and interactive Web pages. Dynamic HTML provides authors with enhanced creative control so they can manipulate any page element at any time. Dynamic HTML is also the easiest way to make Web pages interactive, using open, standards-based technologies. Microsoft is working with the World Wide Web Consortium (W3C) to help ensure interoperability and support for users on multiple systems with different browsers. According to Microsoft DHTML (first implemented in IE 4.0) is a set of innovative features which allows web developers to change the rendering and content of a document on the fly without relying on server-side program (such as Active Server Pages or ColdFusion) or complicated sets of HTML pages to achieve special effects. DHTML can be described as an interface which makes it possible to access the 68 browser object model though JavaScript or VBScript scripting language. This way you can control your page more efficiently. And yes, you can actually make a page without HTML tags at all! DHTML is the art of making HTML pages dynamic! DHTML is a combination of technologies used to create dynamic and interactive Web sites. To most people DHTML means a combination of HTML, Style Sheets and JavaScript. What is DHTML?
  • 69. “DHTML is the combination of several built-in browser features in fourth 69 generation browsers that enable a web page to be more dynamic” DHTML is NOT a scripting language (like JavaScript), but merely a browser feature-or enhancement-that gives your browser the ability to be dynamic. What you really want to learn is not DHTML itself, but rather, the syntax needed to use DHTML. DHTML is a collection features that together, enable your web page be dynamic. I think its important now to define just what is meant by Dynamic? “Dynamic” is defined as the ability of the browser to alter a web page’s look and style after the document has loaded. I remember when I was learning JavaScript, I was taught that you could use document. Writer () method of JavaScript to create webpages on the fly. For example: <script> document.write (“This is text created on the fly!”) </script> But what if we wanted to create content not only on the fly, but on demand? We can do that, by nesting the above code in a function, and calling it via a form button: <input type=”button” onClick=”writeconent()” value=”text”> Pressing the button will erase the entire web page and we were left with only the text the function produced. That was back then. Now, with the introduction of DHTML, we can alter content on a web page on demand, whenever we feel like it, without having the browser erase everything else. That’s what DHTML is all about. The ability of the browser to change look and style even after the document has loaded. The technology of DHTML is currently at its development stage, with NE, IE 5 differing quite greatly in their implementation of this great technology. Its currently not possible to write one DHTML code and expect it to function in both browsers properly. Furthermore, the two browsers are at different stages in their development of DHTML; form my own knowledge and what I’ve heard, DHTML in IE is far more powerful and versatile then NS’s. Dynamic HTML Features Dynamic HTML gives authors enhanced control of the elements on their pages. When you have applied one of the FrontPage Dynamic HTML commands to text or graphics, Microsoft Internet Explorer 4.0 and other Web browsers that support Dynamic HTML will
  • 70. animate the text or graphics or apply other effects that you select. Because it does not require fetching information from the web server, Dynamic HTML is very efficient, and presents the user with a lively, compelling page without requiring time- consuming network activity. The FrontPage Editor includes the following Dynamic HTML features: · Animation · Page transitions · Outlining · Form enhancements Key features of Dynamic HTML include these: · Document Object Model (DOM). Dynamic HTML provides a comprehensive object model for HTML. This model exposes all page elements as objects. These objects can easily be manipulated, by changing their attributes or applying methods to them at any time. Dynamic HTML also provides full support for keyboard and mouse events on all page elements. Support for the Document Object Model enables the following: · Dynamic content. Text or graphics can be added, deleted, or modified on the flu. For example, a Web page can display an updated headline, without refreshing the page. The text surrounding the headline will reflow automatically. · Dynamic styles. Internet Explorer 4.0 fully supports cascading Style Sheets (CSS). As such, any CSS attribute, including color and font, can be updated without a server round-trip. For instance, text can change color or size when a mouse pointer passes over it. Multimedia filters and transition effects can be applied to HTML elements simply by adding the filter CSS attribute. · Absolute positioning. CSS positioning coordinates for existing page content 70 can be updated at any tine to create animated effects, without reloading the page. · Data Binding. Data-driven application front ends can be built that present, manipulate (e.g., sort, filter), and update data on the client without numerous round-trips to the server. · Scriptlets. A Scriptlets is a Web page, authored with Dynamic HTML, which content providers can use as a component in their Web applications. With Scriptlets, content providers can author content once, then easily reuse the content in other Web pages or applications.
  • 71. 71 Understanding Interactivity It is important to define interactivity for the purposes of this guide. The following criteria are suggested for defining a truly interactive Web page: “The page author must be able to update any element of the page at any time— during and after the loading of the page. · The page should capture all user actions and enable authors to respond to these events using simple scripts. · The page should reflect the relationship among page elements. A change to one element in the page may require readjusting other elements. An interactive page should do this automatically. · If authors so choose, users should be able to freely change any element in the page at any time. What you should already know Before you continue you should have a basic understanding of the following: · HTML · CSS · JavaScript Cascading Style Sheets are design templates that provide augmented control over presentation and layout of HTML elements. They allow you to separate the way you design information from the HTML content. JavaScript is used to create interactive web application supported by the Netscape browser. JavaScript offers many of the same advantages as VBScript. JavaScript is simple to use, lightweight, and dynamic. Developers can easily code functionality for interactive applications inside a web page. DHTML is NOT a W3C Standard DHTML stands for Dynamic HTML. DHTML is not a standard defined by the World Wide Web Consortium (W3C). DHTML is a “marketing term” – used by Netscape and Microsoft to describe the new technologies the 4.x generation browsers would support.