HTML Notes by Heera
HTML Notes by Heera
Contents
1. Introduction to HTML
2. HTML Basics Tags
3. HTML Attributes
4. HTML formatting Tags
5. Presentational tags
6. HTML Phrase tags
7. HTML comments
8. HTML Fonts
9. HTML Marquees
10. HTML Images
11. HTML Text Links
12. HTML Images Links
13. HTML Email Links
14. HTML Tables
15. HTML Frames
16. HTML Lists
17. HTML Layouts
18. HTML Colors
19. HTML Forms
20. HTML Backgrounds
21. HTML Embed Multimedia
22. HTML Styles
23.
HTML Scripts
2
3
10
16
22
26
31
34
39
41
46
51
54
56
65
72
77
82
87
98
102
108
110
HTML
1. INTRODUCTION TO HTML
1.1 What is HTML?
HTML is a language for describing web pages.
HTML stands for Hyper Text Markup Language
HTML is not a programming language, it is a markup
language
A markup language is a set of markup tags
HTML uses markup tags to describe web pages
HTML
2. HTML Basic Tags:
The basic structure for all HTML documents is simple and
should include the following minimum elements or tags:
<html> - The main container for HTML pages
<head> - The container for page header information
<title> - The title of the page
<body> - The main body of the page
Remember that before an opening <html> tag, an XHTML
document can contain the optional XML declaration, and it should
always contain a DOCTYPE declaration indicating which version of
XHTML it uses.
Now we will explain each of these tags one by one. In this
tutorial you will find the terms element and tag are used
interchangeably.
HTML
As such, start and end HTML tags enclose all the other
HTML tags you use to describe the Web page.
HTML
<head>
<title>HTML Basic tags</title>
<meta name="Keywords" content="HTML, Web Pages" />
<meta name="description" content="HTML Basic Tags" />
<base href="http://www.tutorialspoint.com" />
<link rel="stylesheet" type="text/css" href="tp.css" />
<script type="text/javascript">
uacct = "UA-232293";
urchinTracker();
</script>
</head>
HTML
</head>
HTML
<link
rel="stylesheet"
type="text/css"
href="tp.css" />
<script type="text/javascript">
_uacct = "UA-232293";
urchinTracker();
</script>
</head>
<body>
<p>This is a paragraph tag.</p>
</body>
</html>
HTML
You can add metadata to your web pages by placing <meta>
tags between the <head> and </head> tags. The can include the
following attributes:
Attriute
Description
Name
content
scheme
http-equiv
NOTE: Core attributes for all the elements are discussed in next
chapter.
Meta Tag Examples:
Let's see few important usage of Meta Tags.
HTML
We specify keywords which will be used by the search
engine to search a web page. So using following tag you can specify
important keywords related to your page.
<head>
<meta name="keywords" content="HTML, meta
tags, metadata" />
</head>
name="revised"
content="HTML,
6/12/2009" />
</head>
HTML
<head>
<meta http-equiv="refresh" content="10" />
</head>
HTML
HTML
3. HTML Attributes
Attributes are another important part of HTML markup. An
attribute is used to define the characteristics of an element and is
placed inside the element's opening tag. All attributes are made up
of two parts: a name and a value:
* The name is the property you want to set. For example, the
<font> element in the example carries an attribute whose name is
face, which you can use to indicate which typeface you want the
text to appear in.
* The value is what you want the value of the property to be.
The first example was supposed to use the Arial typeface, so the
value of the face attribute is Arial.
The value of the attribute should be put in double quotation
marks, and is separated from the name by the equals sign. You can
see that a color for the text has been specified as well as the
typeface in this <font> element:
HTML
We will discuss style sheet in separate tutorial. For now, the
id attribute could be used to distinguish between two paragraph
elements, like so:
<p id="html">This para explains what is HTML</p>
<p id="css">This para explains what is Casecading
Style Sheet</p>
Note that there are some special rules for the value of the id
attribute, it must:
* Begin with a letter (A.Z or a.z) and can then be followed
by any number of letters, digits (0.9), hyphens, underscores, colons,
and periods.
* Remain unique within that document; no two attributes
may have the same value within that HTML document.
title="Hello
HTML!">Titled
Example</h4>
Above code will generate following result:
Titled Heading Tag Example
Heading
Tag
HTML
The class attribute is used to associate an element with a
style sheet, and specifies the class of element. You learn more about
the use of the class attribute when you will learn Casecading Style
Sheet (CSS). So for now you can avoid it.
The value of the attribute may also be a space-separated list
of class names.
For example:
class="className1 className2 className3"
style="font-family:
arial;
color:#FF0000;">Some
text...</p>
rtl
Meaning
Left to right (the default
value)
Right
to
languages
left
such
(for
as
HTML
Example:
<html dir=rtl>
<head>
<title>Display Directions</title>
</head>
<body>
This is how IE 5 renders right-to-left directed text.
</body>
</html>
When dir attribute is used within the <html> tag, it
determines how text will be presented within the entire document.
When used within another tag, it controls the text's direction for just
the content of that tag.
HTML
The values of the lang attribute are ISO-639 standard twocharacter language codes.Check HTML Language Codes: ISO 639
for a complete list of language codes.
Example:
<html lang=en>
<head>
<title>English Language Page</title>
</head>
<body>
This page is using English Language
</body>
</html>
3.4.1.3 The xml:lang Attribute:
The xml:lang attribute is the XHTML replacement for the
lang attribute. The value of the xml:lang attribute should be an ISO639 country code as mentioned in previous section.
Attribute
align
Options
Function
right,
Horizontally
center
left,
aligns tags
HTML
Vertically
valign
top, middle,
bottom
aligns tags
within an
HTML
element.
numeric,
bgcolor
hexidecimal
,
RGB
values
Places a
background
color behind
an
element
Places an
backgroun
d
background
URL
image
behind an
element
Names an
element
id
User
Defined
Cascading
Style
Sheets.
Classifies an
element
class
User
Defined
Cascading
Style
Sheets.
Specifies
width
the
Numeric
width
of
Value
tables, images,
or table cells.
height
Prepared by HEERA SINGH .T
17
Numeric
Specifies
the
HTML
height
Value
of
tables, images,
or table cells.
title
User
Defined
"Pop-up" title
for
your elements
HTML
HTML
treated as one space. So you need to use special HTML tags to
create more number of empty lines.
This is heading 1
This is heading 2
This is heading 3
This is heading 4
This is heading 5
This is heading 6
HTML
<p>Here is a paragraph of text.</p>
<p>Here is a second paragraph of text.</p>
<p>Here is a third paragraph of text.</p>
This will produce following result:
Here is a paragraph of text.
Here is a second paragraph of text.
Here is a third paragraph of text.
You can use align attribute to align your paragraphs.
<p align="left">This is left aligned.</p>
<p align="center">This is center aligned.</p>
<p align="right">This is right aligned.</p>
<p align="justify">This is jutified. This works when
you have multiple lines in your paragraph and you
want to justfy all the lines so that they can look more
nice.</p>
This will produce following result:
This is left aligned.
This is center aligned.
This is right aligned.
HTML
HTML
<p>This is in the center.</p>
</center>
This will produce following result:
This is not in the center.
This is in the center.
HTML
In cases where you want a client browser to be able to
hyphenate a word if necessary, use the soft hyphen entity (­) to
specify where a word should be hyphenated. So above example
should be written as follows:
<p style="text-align: justify;"> Example for soft hyphen The
morbid
fear
of
the
number
13,
or
HTML
function testFunction( strText ){
alert (strText)
}
HTML
have trouble rendering the line break, while if you miss the forward
slash character and just use <hr> it is not valid XHTML.
HTML
5. Presentational Tags
If you use a word processor, you are familiar with the ability
to make text bold, italicized, or underlined; these are just three of
the ten options available to indicate how text can appear in HTML
and XHTML.
following
<i>italicized</i> typeface.</p>
This will produce following result:
Prepared by HEERA SINGH .T
27
word
uses
HTML
The following word uses a italicized typeface.
following
word
uses
<u>underlined</u> typeface.</p>
This will produce following result:
The following word uses a underlined typeface.
HTML
<p>The
following
word
uses
<tt>monospaced</tt> typeface.</p>
This will produce following result:
The following word uses a monospaced typeface.
following
word
uses
<sup>superscript</sup> typeface.</p>
This will produce following result:
The following word uses a superscript typeface.
HTML
HTML
attach a style to this <div> element so that they appear using a
special set of style rules.
The <div> element is used to group block-level elements
together:
<div id="menu" align="middle" >
<a href="/index.htm">HOME</a> |
<a href="/about/contact_us.htm">CONTACT</a> |
<a href="/about/index.htm">ABOUT</a>
</div>
<div id="content" align="left" bgcolor="white">
<h5>Content Articles</h5>
<p>Actual content goes here.....</p> </div>
is
the
example
of
<span
tag</span>
alongwith
CSS</p></div>
This will produce following result:
This is the example of span tag and the div tag
alongwith CSS
Prepared by HEERA SINGH .T
31
HTML
These tags are commonly used with CSS to allow you to
attach a style to a section of a page.
HTML
<p>You <strong>must</strong> remember to close
elements in XHTML.</p>
This will produce following result:
You must remember to close elements in XHTML.
have
friend
called
<abbr
title="Abhishek">Abhy</abbr>.</p>
This will produce following result:
I have a friend called Abhy.
HTML
At present, the major browsers do not change the appearance
of the content of the <acronym> element.
HTML
XHTML 1.0 is the W3C's first Recommendation for XHTML,
following on from earlier work on HTML 4.01, HTML 4.0, HTML 3.2
and HTML 2.0.
You can use the cite attribute on the <blockquote> element
to indicate the source of the quote.
<p>The following description of XHTML is taken
from theW3C Web site:</p> <blockquote
cite="http://www.w3.org/markup/"> XHTML 1.0 is the
W3C's first Recommendation for XHTML, following on
from earlier work on HTML 4.01, HTML 4.0, HTML 3.2
and HTML 2.0. </blockquote>
HTML
<p>This HTML Tutorial is derived from <cite>World
Wide Web Standard for HTML</cite>.</p>
This will produce following result:
This HTML Tutorial is derived from World Wide Web Standard for
HTML.
HTML
This is inside kbd element
HTML
304, Menna Colony, Hyderabad - INDIA, 500032
7. HTML Comments
Comments are piece of code which is ignored by any web browser. It is
good practice to comment your code, especially in complex documents, to
indicate sections of a document, and any other notes to anyone looking at the
code. Comments help you and others understand your code.
HTML Comment lines are indicated by the special beginning tag <!-and ending tag --> placed at the beginning and end of EVERY line to be treated
as a comment.
Prepared by HEERA SINGH .T
38
HTML
Comments do not nest, and the double-dash sequence "--" may not
appear inside a comment except as part of the closing --> tag. You must also
make sure that there are no spaces in the start-of-comment string.
For example: Given line is a valid comment in HTML
<!-- This is commented out -->
But following line is not a valid comment and will be displayed by the
borwser. This is because there is a space between the left angle bracket and the
exclamation mark.
< !-- This is commented out -->
Be careful if you use comments to "comment out" HTML that would
otherwise be shown to the user, since some older browsers will still pay
attention to angle brackets inside the comment and close the comment
prematurely -- so that some of the text that was supposed to be inside the
comment mistakenly appears as part of the document.
HTML
7.2 Conditional Comments :
Conditional comments only work in Explorer on Windows, and are thus
excellently suited to give special instructions meant only for Explorer on
Windows. They are supported from Explorer 5 onwards, and it is even possible
to distinguish between 5.0, 5.5 and 6.0.
Conditional comments work as follows:
<!--[if IE 6]>
Special instructions for IE 6 here
<![endif]-->
* Their basic structure is the same as an HTML comment (<!-- -->).
Therefore all other browsers will see them as normal comments and will
ignore them entirely.
* Since conditional comments use the HTML comment structure, they can
only be included in HTML files, and not in CSS files.
HTML
7.4 Commenting Scripts and Style Sheets:
If you are using Java Script or VB Script in your HTML code then it is
recommended to put that script code inside proper HTML Comments to make
old browser works properly.
For example:
<script>
<!-document.write("Hello World!")
//-->
</script>
Similarly if you are using Casecading Style Sheet in your HTML code
then it is recommended to put that style sheet code inside proper HTML
Comments to make old browser works properly.
For example:
<style>
<!-img{
border:0px;
}
//-->
</style>
HTML
8. HTML Fonts
Font face and color depends entirely on the computer and browser that
is being used to view your page. But the <font> tag is used to add style, size,
and color to the text on your site. You can use a <basefont> tag to set all of
your text to the same size, face, and color.
The font tag is having three attributes called size, color, and face to
customize your fonts.
To change any of the font attributes at any time within your page,
simply use the <font> tag. The text that follows will remain changed until you
close with the </font> tag. You can change any or all of the font attributes at the
one time, by including all the required changes within the one <font> tag.
NOTE: The font and basefont tags are deprecated and it is
supposed to be removed in a future version of HTML. So it should not be
used. Its is suggested to use css styles to manipulate your font.
HTML
Font size="1"
Font size="2"
Font size="3"
Font size="4"
Font size="5"
Font size="6"
Font size="7"
SPECIFY THE RELATIVE FONT SIZE. <font size="+n"> or
<font size="-n">:You can specify how many sizes larger or how many sizes
smaller than the preset font size should be.
Prepared by HEERA SINGH .T
43
HTML
Example:
<font size="-1">Font size="-1"</font>
<font size="+1">Font size="+1"</font>
<font size="+2">Font size="+2"</font>
<font size="+3">Font size="+3"</font>
<font size="+4">Font size="+4"</font>
Font size="+1"
Font size="+2"
Font size="+3"
Font
size="+4"
8.2 Font Face:
You can set any font you like using face attribute but be aware that if
the user viewing the page doesn't have the font installed, they will not be able
to see it. Instead they will default to Times New Roman of your font with size
attribute. See below few examples on using different font face
Example:
<font
face="Times
Roman</font>
Prepared by HEERA SINGH .T
44
New
Roman"
size="5">Times
New
HTML
<font face="Verdana" size="5">Verdana</font>
<font face="Comic sans MS" size="5">Comic Sans MS</font>
<font face="WildWest" size="5">WildWest</font>
<font face="Bedrock" size="5">Bedrock</font>
This will produce following result:
HTML
HTML
two sizes larger</font></p>
<p><font face="courier" size="-1" color="#000000">Here is a courier
font, a size smaller, in black</font></p>
This will produce following result:
This is the page's default font.
As you can see, the default font now takes on the properties specified in
the <basefont> element. It is red, size 2, and uses the Arial typeface.
The paragraph after the <h2> element uses a font size two sizes larger
than the default size and is gray text, whereas the following paragraph uses a
font one size smaller than the default font. You can also see that the color of
this font is black (overriding the default).
HTML
9. HTML Marquees
A HTML marquee is a scrolling piece of text displayed either
horizontally across or vertically down your web site page depending on the
settings. This is created by using HTML tag <marquees>.
NOTE: The HTML <marquee> is an MSIE extension, but is now
supported by NS 7 also. So please check if your browser supports this tag or
not.
Syntax:
A simple syntax to use marquee is as follows:
<marquee attribute_name="attribute_value"....more attributes>
Prepared by HEERA SINGH .T
48
HTML
One or more lines or text message or image
</marquee>
9.1 Attrubutes:
A HTML marquee can have following attributes:
1) width: how wide the marquee is. This will have a value like 10
or 20%etc.
2) height: how tall the marquee is. This will have a value like 10 or
20% etc.
3) direction: which direction the marquee should scroll. This will
have value either up, down, left or right.
4) behavior: what type of scrolling. This will have value scroll, slid
and alternate.
5) scrolldelay: how long to delay between each jump. This will
have a value like 10 etc.
6) scrollamount: how far to jump. This will have a value like 10
etc.
7) loop: how many times to loop. The default value is INFINITE,
which means that the marquee loops endlessly.
8) bgcolor: background color. This will have any color name or
color hex value.
9) hspace: horizontal space around the marquee. This will have a
value like 10 or 20%etc.
10) vspace: vertical space around the marquee. This will have a
value like 10 or 20%etc.
HTML
Examples:
Here are few examples to demonstrate the usage of marquee tag.
<marquee>This is basic example of marquee</marquee>
<marquee width="50%">This example will take only 50%
width</marquee>
<marquee direction="right">This text will scroll from left to
right</marquee>
<marquee direction="up">This text will scroll from bottom to
up</marquee>
HTML
10. HTML Images
Images are very important to beautify as well as to depicts many
concepts on your web page. Its is true that one single image is worth than
thuasands of words. So as a Web Developer you should have clear
understanding on how to use images in your web pages.
10.1 Insert Image - The <img> Element:
You will insert any image in your web page by using <img> tag.
Following is the simple syntax to use this tag.
<img
src="image
URL"
attr_name="attr_value"...more
attributes />
10.2 Image Attributes:
Following are most frequently used attributes for <img> tag.
1) width: sets width of the image. This will have a value like 10 or 20%etc.
2) height: sets height of the image. This will have a value like 10 or 20%
etc.
3) border: sets a border around the image. This will have a value like 1 or
2 etc.
4) src: specifies URL of the image file.
5) alt: this is an alternate text which will be displayed if image is missing.
6) align: this sets horizontal alignment of the image and takes value either
left, right or center.
7) valign: this sets vertical alignment of the image and takes value either
top, bottom or center.
HTML
8) hspace: horizontal space around the image. This will have a value like
10 or 20%etc.
9) vspace: vertical space around the image. This will have a value like 10
or 20%etc.
10) name: name of the image with in the document.
11) id: id of the image with in the document.
12) style: this will be used if you are using CSS.
13) title: specifies a text title. The browser, perhaps flashing the title when
the mouse passes over the link.
14) ismap and usemap: These attributes for the <img> tag tell the browser
that the image is a special mouse-selectable visual map of one or more
hyperlinks, commonly known as an image map. We will see how to use
these attributes in Image Links chapter
A Simple Example:
<img src=" d:/nature/p116.jpeg " alt="Nature" />
Image Attributes - width, height, title, border and align:
Now let us try to set some more attributes:
<img
src="d:/nature/p116.jpeg
"
alt="Nature"
width="100"
HTML
Remember that all the images will have a border by default. In our
examples its not showing because our global style sheet has set img
{border:0px;} which means that no border will be displayed till it is mentioned
explicitly.
You can remove an image border by setting border="0" or through
CSS by setting img {border:0px;}.
Wrapping text around images:
Example 1:
<p>This is the first paragraph that appears above the paragraph with
the
image!</p>
specified
paragraph.</p>
<p>The left and right image-alignment values tell the browser to place
an image against the left or right margin, respectively, of the current
text flow. The browser then renders subsequent document content in
the remaining portion of the flow adjacent to the image. The net result
is that the document content following the image gets wrapped around
the image. </p>
This is the first paragraph that appears above the paragraph with the
image!
HTML
The image will appear along the right hand side of the paragraph. As
you can see this is very nice for adding a little eye candy that relates to
the specified paragraph.
The left and right image-alignment values tell the browser to place an
image against the left or right margin, respectively, of the current text
flow. The browser then renders subsequent document content in the
remaining portion of the flow adjacent to the image. The net result is
that the document content following the image gets wrapped around
the image.
Example 2:
You can use vspace or hspace attributes if you want to keep some
distance between text and image. Let us revise above example:
<p>This is the first paragraph that appears above the paragraph with
the
image!</p>
align="right">
The image will appear along the right hand side of the paragraph. As
you can see this is very nice for adding a little eye candy that relates
to
the
specified
paragraph.</p>
HTML
place an image against the left or right margin, respectively, of the
current text flow. The browser then renders subsequent document
content in the remaining portion of the flow adjacent to the image.
The net result is that the document content following the image gets
wrapped around the image. </p>
This is the first paragraph that appears above the paragraph with the
image!
The image will appear along the right hand side of the paragraph. As
you can see this is very nice for adding a little eye candy that relates to
the specified paragraph.The left and right image-alignment values tell
the browser to place an image against the left or right margin,
respectively, of the current text flow. The browser then renders
subsequent document content in the remaining portion of the flow
adjacent to the image. The net result is that the document content
following the image gets wrapped around the image.
HTML
the down side, gifs are usually larger files, not as compressed as a jpeg, which
calls for slow load times and large transfer rates. Gifs are also limited to the
256 color scheme.
Ths images in Joint Photographic Experts Group - JPEG format have
an unlimited color wheel, and have a high compression rate downsizing your
load times and saving hard drive space. JPEGs don't allow for transparent
backgrounds, but their size/quality ratio is outstanding. Its best to use JPEG
format for photo galleries, or artwork to allow the viewer to catch that extra bit
of detail. Avoid Jpegs for graphical design, stick to using them for thumbnails
and backgrounds.
The images in Portable Network Graphics - PNG format is an
extensible file format for the lossless, portable, well-compressed storage of
raster images. PNG provides a patent-free replacement for GIF and can also
replace many common uses of TIFF. Indexed-color, grayscale, and truecolor
images are supported, plus an optional alpha channel. Sample depths range
from 1 to 16 bits. PNG also compresses better than GIF in almost every case
(5% to 25% in typical cases).
HTML
href="Document
URL"
attr_name="attr_value"...more
attributes />
HTML
same window will be used to display the loaded document, if set
to "_self" then loads the new page in current window. By default
its "_self".
3) name & id: attributes places a label within a document. When
that label is used in a link to that document, it is the equivalent
of telling the browser to goto that label.
4)
5) title: attribute lets you specify a title for the document to which
you are linking. The value of the attribute is any string, enclosed
in quotation marks. The browser might use it when displaying
the link, perhaps flashing the title when the mouse passes over
the link.
6) accesskey: attribute attribute provides a keyboard shortcut that
can be used to activate a link. For example, you could make the
T key an access key so that when the user presses either the Alt
or Ctrl key on his keyboard (depending on his operating system)
along with the T key, the link gets activated.
A Simple Example:
<a
href="http://www.tutorialspoint.com/"
target="_blank"
Home</a>
<a
target="_self"
href="http://www.amrood.com/"
Home</a>
>TP
>AMROOD
|
HTML
11.3 Base Path for Links:
It is not required to give a complete URL for every link. You can get rid
of it if you will use <base> tag in your header. This tag is used to give a base
path for all the links. So your browser will concatenate given relative path to
this base path and will make a complete URL.
For example we have used following base tag in all the pages at
tutorialspoint.com:
<head>
<base href="http://www.tutorialspoint.com/">
</head>
So now if you will use <a href="/html/index.htm" then it will be
considered as <a href="http://www.tutorialspoint.com/html/index.htm".
HTML
This will produce following link and you try using this link to reach to the top
of this page:
Go to the Top
NOTE: Here we are using relative path. You can give complete URL
and
then
and
then
link
name
eg.
http://www.tutorialspoint.com/html/html_text_links.htm#top
You can use this type of URL in any other page to reach directly to a
particular section.
11.5 Setting Link Colors:
You can set colors of your links, active links and visited links using link,
alink and vlink attributes of <body> tag. But it is recommended to use CSS to
set colors of links, visited links and active links.
Following is the example we have used for our web side tutorialspoint.com
a:link
{color:#900B09; background-color:transparent}
HTML
11.6 Create Download Links:
You can create text link to make your PDF, or DOC or ZIP files
downloadable. This is very simple, you just need to give complete URL of the
downloadable file as follows:
<a href="http://www.example.com/file.pdf">Download File</a>
This will produce following link and will be used to download a file.
Download File
You can not make an image download able until you follow the following
procedure.
How To Raise a "File Download" Dialog Box ?
Sometime it is desired that you want to give option where a use will
click a link and it will pop up a "File Download" box to the user in stead of
displaying actual content. This is very easy and will be achived through HTTP
header.
This HTTP header will be different from the header mentioned in
previous section.
For example,if you want make a FileName file downloadable from a
given link then its syntax will be as follows.
#!/usr/bin/perl
# HTTP Header
print
"Content-Type:application/octet-stream;
name=\"FileName\"\r\n";
print
"Content-Disposition:
filename=\"FileName\"\r\n\n";
Prepared by HEERA SINGH .T
61
attachment;
HTML
HTML
HTML
The coordinates of the mouse position are screen pixels counted from
the upper-left corner of the image, beginning with (0,0). The coordinates,
preceded by a question mark, are added to the end of the URL.
For example, if a user clicks 50 pixels over and 30 pixels down from the
upper-left corner of the image displayed from the following link:
<a href="/cgi-bin/logo.map" target="_self" >
<img ismap src="/images/html.gif"
alt="HTML" border="0"/>
</a>
Then the browser sends the following search parameters to the HTTP
server which can be processed by cgi script or map file and you can link
whatever you like to these coordinates:
/cgi-bin/logo.map?50,30
NOTE: Converting the coordinates into a specific document is handled
by the server side application, either cgi programme or special map files
provided by seb server. For more detail Check Using HTML ismap.
12.2 Client-Side Image Maps:
Client side image maps are enabled by the usemap attribute for the
<img /> tag and defined by special <map> and <area> extension tags.
The image that is going to form the map is inserted into the page using
the <img /> element as normal, except it carries an extra attribute called
usemap. The value of the usemap attribute is the value of the name attribute on
the <map> element, which you are about to meet, preceded by a pound or hash
sign.
The <map> element actually creates the map for the image and usually
follows directly after the <img /> element. It acts as a container for the <area />
elements that actually define the clickable hotspots. The <map> element carries
Prepared by HEERA SINGH .T
64
HTML
only one attribute, the name attribute, which is the name that identifies the map.
This is how the <img /> element knows which <map> element to use.
The <area> element specifies the shape and the coordinates that define
the boundaries of each clickable hotspot. Here's an example from the image
map:
<img
src=/images/html.gif
alt="HTML
Map"
border="0"
usemap="#html"/>
<!-- Create Mappings -->
<map name="html">
<area shape="circle"
coords="154,150,59" href="link1.htm" alt="link 1"
target="_self" />
<area shape="poly"
coords="272,79,351,79,351,15,486,15,486,218,272,218,
292,166,292,136,270,76" alt="link 2"
href="link2.htm" target="_self" />
<area shape="rect"
coords="325,224,488,286" alt="link 3"
href="link3.htm" target="_self" />
</map>
The actual value of coords is totally dependent on the shape in question.
Here is a summary, to be followed by detailed examples:
rect = x1 , y1 , x2 , y2
x1 and y1 are the coordinates of the upper left corner of the
rectangle; x2 and y2 are the coordinates of the lower right corner.
Therefore, a rectangle which goes from 10,5 to 20,25 would have the
attribute coords="10,5,20,25". A rectangle which defines the upper-left
quarter of an image might use coords="0,0,50%,50%".
circle = xc , yc , radius
Prepared by HEERA SINGH .T
65
HTML
xc and yc are the coordinates of the center of the circle, and
radius is the circle's radius. A circle centered at 200,50 with a radius of
25 would have the attribute coords="200,50,25"; one centered at the
image's center and having a diameter of half the image would be
defined by coords="50%,50%,25%".
poly = x1 , y1 , x2 , y2 , x3 , y3 , ... xn , yn
The various x-y pairs define vertices (points) of the polygon,
with a "line" being drawn from one point to the next point. A diamondshaped polygon with its top point at 20,20 and 40 pixels across at its
widest
points
would
have
the
attribute
13.
This is very easy to put an HTML email link on your page. But while
doing so, you need to put your email address on your web page which can
cause a spamming problem for your email account. There are many guys over
the internet who can run programs to harvest these types of emails for
spamming. So if you are going to put your email link on a public website then
you have be prepared for anti-spamming as well.
You can have another option to facilitate people to send you emails.
This option is to use HTML forms to take user data and then use CGI script to
send an email.
13.1 HTML Email Tag:
HTML <a> tag provides you facility to specifiy an email address to
send an email. While using <a> tag as an email tag then you will use
mailto:email address along with href attribute. Following is the syntax of
using mailto instead of using http.
<a href= "mailto:[email protected]">Send Email</a>
Prepared by HEERA SINGH .T
66
HTML
This code will generate following link:
Send Email
Now if a user will click this link then it will lanuch one Email Client
( like Lotus Notes, Outlook Express etc. ) installed on your user's computer.
This is another risk to use this procedure because if users do not have
email client installed on their computer then it would not be possible to send
you email.
Default Email Subject and Body:
You can specify a default email subject and email body alongwith your
email address. Following is the example to use default subject and body.
<a href="mailto:[email protected]?
subject=Feedback&body=Message">
Send Feedback
</a>
This code will generate following link:
Send Feedback
HTML
14.
HTML Tables
Tables are very useful to arrange in HTML and they are used very
frequently by almost all web developers. Tables are just like spreadsheets and
they are made up of rows and columns.
You will create a table in HTML/XHTML by using <table> tag. Inside
<table> element the table is written out row by row. A row is contained inside a
<tr> tag . which stands for table row. And each cell is then written inside the
row element using a <td> tag . which stands for table data.
Example:
<table border="1">
<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
</tr>
<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
Prepared by HEERA SINGH .T
68
HTML
</tr>
</table>
This will produce following result:
Row 1, Column 1
Row 1, Column 2
Row 2, Column 1
Row 2, Column 2
HTML
<tr>
<td>Shabbir Hussein</td>
<td>7000</td>
</tr>
</table>
This will produce following result. You can see its making heading as a bold
one:
Name
Salary
Ramesh Raman
5000
Shabbir Hussein
7000
NOTE: Each cell must, however, have either a <td> or a <th> element
in order for the table to display correctly even if that element is empty.
HTML
<td>5000</td>
</tr>
<tr>
<td>Shabbir Hussein</td>
<td>7000</td>
</tr>
</table>
Name
Salary
Ramesh Raman
5000
Shabbir Hussein
7000
You will use colspan attribute if you want to merge two or more
columns into a single column. Similar way you will use rowspan if you want to
merge two or more rows. Following is the example:
<table border="1">
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
<tr><td rowspan="2">Row 1 Cell 1</td>
<td>Row 1 Cell 2</td><td>Row 1 Cell 3</td></tr>
<tr><td>Row 2 Cell 2</td><td>Row 2 Cell 3</td></tr>
<tr><td colspan="3">Row 3 Cell 1</td></tr>
Prepared by HEERA SINGH .T
71
HTML
</table>
Column 2
Column 3
Row 1 Cell 2
Row 1 Cell 3
Row 2 Cell 2
Row 2 Cell 3
Row 3 Cell 1
14.3 Tables Backgrounds
You can set table background using of the following two ways:
Using bgcolor attribute - You can set background color for whole table or
just for one cell.
Using background attribute - You can set background image for whole table
or just for one cell.
NOTE:You can set border color also using bordercolor attribute.
Here is an example of using bgcolor attribute:
HTML
<tr><td colspan="3">Row 3 Cell 1</td></tr>
</table>
Column 2
Column 3
Row 1 Cell 2
Row 1 Cell 3
Row 2 Cell 2
Row 2 Cell 3
Row 3 Cell 1
Column 2
Column 3
HTML
Row 1 Cell 1
Row 1 Cell 2
Row 1 Cell 3
Row 2 Cell 2
Row 2 Cell 3
Row 3 Cell 1
14.4 Table height and width:
You can set a table width and height using width and height attrubutes.
You can specify table width or height in terms of integer value or in terms of
percentage of available screen area. Following is the example:
<table border="1" width="400" height="150">
<tr>
<td>Row 1, Column 1</td>
<td>Row 1, Column 2</td>
</tr>
<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
</table>
This will produce following result:
Row 1, Column 1
Row 1, Column 2
Row 2, Column 1
Row 2, Column 2
HTML
row 1, column 1
row 1, columnn 2
HTML
<tr>
<td>Cell 1</td>
<td>Cell 2</td>
<td>Cell 3</td>
<td>Cell 4</td>
</tr>
<tr>
...more rows here containing four cells...
</tr>
</tbody>
</table>
This will produce following result:
This is the head of the table
This is the foot of the table
Cell 1
Cell 2
Cell 3
Cell 4
Cell 2
Cell 3
Cell 4
HTML
<td>Shabbir Hussein</td>
<td>7000</td>
</tr>
</table>
</td>
<td>
<ul>
<li>This is another cell</li>
<li>Using list inside this cell</li>
</ul>
</td>
</tr>
<tr>
<td>Row 2, Column 1</td>
<td>Row 2, Column 2</td>
</tr>
</table>
This will produce following result:
Name
Salary
Ramesh Raman
5000
Shabbir Hussein
7000
Row 2, Column 1
15.
HTML Frames
HTML
Frames divide a browser window into several pieces or panes, each
pane containing a separate XHTML/HTML document. One of the key
advantages that frames offer is that you can then load and reload single panes
without having to reload the entire contents of the browser window. A
collection of frames in the browser window is known as a frameset.
The window is divided up into frames in a similar pattern to the way
tables are organized: into rows and columns. The simplest of framesets might
just divide the screen into two rows, while a complex frameset could use
several rows and columns.
There are few drawbacks also you should be aware of with frames are
as follows:
Some smaller devices cannot cope with frames, often because their
screen is not big enough to be divided up.
The browser's back button might not work as the user hopes.
There are still few browsers who do not support farme technology.
HTML
The <frameset> tag defines how to divide the window into frames.
Example:
Following is the example to create three horizontal frames:
<html>
<head>
<title>Frames example</title>
</head>
<frameset rows="10%,80%,10%">
<frame src="/html/top_frame.htm" />
<frame src="/html/main_frame.htm" />
<frame src="/html/bottom_frame.htm" />
<noframes>
<body>
Your browser does not support frames.
</body>
Prepared by HEERA SINGH .T
79
HTML
</noframes>
</frameset>
</html>
HTML
takes up half of the window, the second takes one third, and the
third takes one sixth.
15.2.2 rows: attribute works just like the cols attribute and can take the
same values, but it is used to specify the rows in the frameset. For example
to create two horizontal frames, use rows="10%, 90%". You can specify the
height of each row in the same way as explained above for columns.
15.2.3 border: attribute specifies the width of the border of each frame in
pixels. For example border="5". A value of zero specifies that no border
should be there.
HTML
<frame src="/html/top_frame.htm" />
<frame src="/html/main_frame.htm" />
<frame src="/html/bottom_frame.htm" />
HTML
15.4.7scrolling: controls the appearance of the scrollbars that appear on
the frame. This takes values either "yes", "no" or "auto". For example
scrolling="no" means it should not have scroll bars.
15.4.8 longdesc: allows you to provide a link to another page
containing a long
description of the contents of the frame. For example
longdesc="framedescription.htm"
HTML
<frameset cols="200, *">
<frame src="/html/menu.htm" name="menu_page" />
<frame src="/html/main.htm" name="main_page" />
</frameset>
There are two columns in this example. The first is 200 pixels wide and
will contain the navigation bar. The second column or frame will contain the
main part of the page. The links on the left side navigation bar will load pages
into the right side main page.
Keep some content in main.htm file and the links in the menu.htm file
look like this:
<a href="http://www.google.com" target="main_page">Google</a>
<br /><br />
<a
href="http://www.microsoft.com"
target="main_page">Microsoft</a>
<br /><br />
<a href="http://news.bbc.co.uk/" target="main_page">BBC News</a>
The target attribute can also take the attribute values listed in the table that
follows.
Vlaue
Description
_self
_blank
_paren Loads the page into the parent window, which in the case of a
t
_top
HTML
src="/html/menu.htm"
width="75"
height="200"
align="right">
Your browser does not support inline frames. To view this
<a href="/html/menu.htm">document</a> correctly, you'll need
a copy of Internet Explorer or the latest Netscape Navigator.
</iframe>
...subsequent document content...
</body>
The align attribute lets you control where the frame gets placed in line
with the adjacent text or moved to the edge of the document, allowing text to
flow around the frame.
HTML
For inline alignment, use top, middle, or bottom as the value of this
attribute. The frame is aligned with the top, middle, or bottom of the adjacent
text, respectively. To allow text to flow around the inline frame, use the left or
right values for this attribute. The frame is moved to the left or right edge of the
text flow, respectively, and the remaining content of the document is flowed
around the frame. A value of center places the inline frame in the middle of the
display, with text flowing above and below.
16.
You can list out your items, subjects or menu in the form of a list.
HTML gives you three different types of lists.
* <ul> - An unordered list. This will list items using bullets
* <ol> - A ordered list. This will use different schemes of numbers to list
your items
* <dl> - A definition list. This is arrange your items in the same way as they
are arranged in a dictionary.
HTML
circles. The default bullet displayed by most web browsers is the traditional full
disc.
One Movie list is given below:
<center>
<h2>Movie List</h2>
</center>
<ul>
<li>Ram Teri Ganga Meli</li>
<li>Mera Naam Jocker</li>
<li>Titanic</li>
<li>Ghost in the ship</li>
</ul>
You can use type attribute to specify the type of bullet you like. By
default its is a disc. Following are the possible way:
<ul type="square">
<ul type="disc">
<ul type="circle">
HTML
<ul
type="square">
<ul type="disc">
<ul type="circle">
Hindi
Hindi
Hindi
English
English
English
Maths
Maths
Maths
Physics
Physics
Physics
HTML
2. Mera Naam Jocker
3. Titanic
4. Ghost in the ship
You can use type attribute to specify the type of numbers you like. By
default its is a generic numbers. Following are the other possible way:
<ol type="I"> - Upper-Case Numerals.
<ol type="i"> - Lower-Case Numerals.
<ol type="a"> - Lower-Case Letters.
<ol type="A"> - Upper-Case Letters.
<ol type="I">
<ol type="i">
<ol type="a">
<ol
type="A">
A. Hindi
I.
Hindi
i.
Hindi
a. Hindi
B. Englis
II.
English
ii.
English
b. English
III.
Maths
iii.
Maths
c. Maths
C. Maths
IV.
Physics
iv.
Physics
d. Physics
D. Physic
s
You can use start attribute to specify the beginning of any index. By
default its is a first number or character. In the following example index starts
from 5:
<center>
<h2>Movie List</h2>
</center>
<ol start="5">
<li>Ram Teri Ganga Meli</li>
<li>Mera Naam Jocker</li>
Prepared by HEERA SINGH .T
89
HTML
<li>Titanic</li>
<li>Ghost in the ship</li>
</ol>
HTML
<dd>This stands for Hyper Text Transfer Protocol</dd>
</dl>
HTML
Custom bullets - make the item after the <dt> tag an icon-sized bullet
image)
Any list of name/value pairs
HTML
<table width="100%" border="0">
<tr>
<td colspan="2" style="background-color:#CC99FF;">
<h1>This is Web Page Main title</h1>
</td>
</tr>
<tr valign="top">
<td style="background-color:#FFCCFF;
width:100px;text-align:top;">
<b>Main Menu</b><br />
HTML<br />
PHP<br />
PERL...
</td>
<td style="background-color:#eeeeee;height:200px;
width:300px;text-align:top;">
Technical and Managerial Tutorials
</td>
</tr>
<tr>
<td colspan="2" style="background-color:#CC99FF;">
<center>
Copyright 2007 Tutorialspoint.com
</center>
</td>
</tr>
</table>
HTML
Main
HTML
PHP
PERL...
HTML
<b>Right Menu</b><br />
HTML<br />
PHP<br />
PERL...
</td>
</tr>
<table>
Right Menu
HTML
HTML
PHP
PHP
PERL...
PERL...
HTML
<div style="width:100%">
<div style="background-color:#CC99FF;">
<b style="font-size:150%">This is Web Page Main title</b>
</div>
<div style="background-color:#FFCCFF;
height:200px;width:100px;float:left;">
<b>Main Menu</b><br />
HTML<br />
PHP<br />
PERL...
</div>
<div style="background-color:#eeeeee;
height:200px;width:300px;float:left;">
Technical and Managerial Tutorials
</div>
<div style="background-color:#CC99FF;clear:both">
<center>
Copyright 2007 Tutorialspoint.com
</center>
</div>
</div>
Menu
HTML
HTML
The <body> tag has following attributes which can be used to set
different colors:
bgcolor: Sets a color for the background of the page.
text: Sets a color for the body text.
alink: Sets a color for active links or selected links.
link: Sets a color for linked text.
vlink: Sets a color for visited links - that is, for linked text that you
have already clicked on.
NOTE: It is recommended to use CSS to set background or text colors.
HTML
W3C Standard 16 Colors:
Here is the list of W3C Standard 16 Colors names and it is recommended to use
them.
Black
Gray
Silver
White
Yellow
Lime
Aqua
Fuchsia
Red
Green
Blue
Purple
Maroon
Olive
Navy
Teal
Color
Prepared by HEERA SINGH .T
99
Color HEX
HTML
#000000
#FF0000
#00FF00
#0000FF
#FFFF00
#00FFFF
#FF00FF
#C0C0C0
#FFFFFF
Color RGB
rgb(0,0,0)
rgb(255,0,0)
rgb(0,255,0)
rgb(0,0,255)
rgb(255,255,0)
rgb(0,255,255)
rgb(255,0,255)
HTML
rgb(192,192,192)
rgb(255,255,255)
000033
000066
000099
0000CC
0000FF
003300
003333
003366
003399
0033CC
0033FF
006600
006633
006666
006699
0066CC
0066FF
009900
009933
009966
009999
0099CC
0099FF
00CC00 00CC33
00CC66
00CC99
00CCCC 00CCFF
00FF00
00FF33
00FF66
00FF99
00FFCC
00FFFF
330000
330033
330066
330099
3300CC
3300FF
333300
333333
333366
333399
3333CC
3333FF
336600
336633
336666
336699
3366CC
3366FF
339900
339933
339966
339999
3399CC
3399FF
33CC00 33CC33
33CC66
33CC99
33CCCC 33CCFF
33FF00
33FF33
33FF66
33FF99
33FFCC
33FFFF
660000
660033
660066
660099
6600CC
6600FF
663300
663333
663366
663399
6633CC
6633FF
666600
666633
666666
666699
6666CC
6666FF
HTML
669900
669966
669999
6699CC
66CC00 66CC33
66CC66
66CC99
66CCCC 66CCFF
66FF00
66FF33
66FF66
66FF99
66FFCC
66FFFF
990000
990033
990066
990099
9900CC
9900FF
993300
993333
993366
993399
9933CC
9933FF
996600
996633
996666
996699
9966CC
9966FF
999900
999933
999966
999999
9999CC
9999FF
99CC00 99CC33
99CC66
99CC99
99CCCC 99CCFF
99FF00
99FF33
99FF66
99FF99
99FFCC
CC0000 CC0033
CC0066
CC0099
CC00CC CC00FF
CC3300 CC3333
CC3366
CC3399
CC33CC CC33FF
CC6600 CC6633
CC6666
CC6699
CC66CC CC66FF
CC9900 CC9933
CC9966
CC9999
CC99CC CC99FF
CCCC33
CCCC66
CCCC99
CCFF00 CCFF33
CCFF66
CCFF99
CCFFCC CCFFFF
FF0000
FF0033
FF0066
FF0099
FF00CC
FF00FF
FF3300
FF3333
FF3366
FF3399
FF33CC
FF33FF
FF6600
FF6633
FF6666
FF6699
FF66CC
FF66FF
FF9900
FF9933
FF9966
FF9999
FF99CC
FF99FF
FFCC00 FFCC33
FFCC66
FFCC99
FFCCCC FFCCFF
FFFF00 FFFF33
FFFF66
FFFF99
FFFFCC
CCCC0
0
669933
CCCCC
C
6699FF
99FFFF
CCCCFF
FFFFFF
HTML
19.
HTML Forms:
HTML Forms are required when you want to collect some data from the
site visitor. For example registration information: name, email address, credit
card, etc.
A form will take input from the site visitor and then will post your backend application such as CGI, ASP Script or PHP script etc. Then your back-end
application will do required processing on that data in whatever way you like.
Form elements are like text fields, textarea fields, drop-down menus,
radio buttons, checkboxes, etc. which are used to take information from the
user.
HTML
method: Here you will specify method to be used to upload data. It can
take
various values but most frequently used are GET and POST.
target: It specifies the target page where the result of the script will be
displayed. It takes values like _blank, _self, _parent etc.
enctype: You can use the enctype attribute to specify how the browser
encodes the data before it sends it to the server. Possible values are like:
There are different types of form controls that you can use to collect
data from a visitor to your site.
Text input controls
Buttons
Checkboxes and radio buttons
Select boxes
File select boxes
Hidden controls
Prepared by HEERA SINGH .T
104
HTML
Submit and reset button
Multi-line text input controls: Used when the user is required to give
details that may be longer than a single sentence. Multi-line input controls
are created with the <textarea> element.
HTML
</form>
name:
Last
name:
HTML
Password
HTML
<form action="/cgi-bin/hello_get.cgi" method="get">
Description : <br />
<textarea rows="5" cols="50" name="description">
Enter description here...
</textarea>
<input type="submit" value="submit" />
</form>
HTML
HTML
HTML
Here is example HTML code for a form with two checkboxes
<form action="/cgi-bin/checkbox.cgi" method="get">
<input type="checkbox" name="maths" value="on"> Maths
<input type="checkbox" name="physics" value="on"> Physics
<input type="submit" value="Select Subject" />
</form>
Physics
HTML
Here is example HTML code for a form with two radio button:
<form action="/cgi-bin/radiobutton.cgi" method="post">
<input type="radio" name="subject" value="maths" /> Maths
<input type="radio" name="subject" value="physics" /> Physics
<input type="submit" value="Select Subject" />
</form>
Physics
HTML
<form action="/cgi-bin/dropdown.cgi" method="post">
<select name="dropdown">
<option value="Maths" selected>Maths</option>
<option value="Physics">Physics</option>
</select>
<input type="submit" value="Submit" />
</form>
HTML
HTML
<input type="submit" value="Next Page" />
</form>
This is page 10
This will produce following result. Type something and click reset button.
Prepared by HEERA SINGH .T
115
HTML
First
name:
Last
name:
HTML
<tagname bgcolor="color_value"...>
HTML
This background is sky blue
</td></tr>
</table>
<!-- Give color value in RGB terms -->
<table bgcolor="rgb(0,0,255)" width="100%" >
<tr><td>
This background is blue
</td></tr>
</table>
HTML
<table background="/images/html.gif" width="100%" height="100">
<tr><td>
This background is filled up with HTML image.
</td></tr>
</table>
<table
background="/images/home.gif"
width="100%"
height="100">
<tr><td>
This background is filled up with home image.
</td></tr>
</table>
Note that when your HTML element is larger than the dimensions of
your picture, the image simply begins to repeat itself.
HTML
background="/images/pattern1.gif"
width="100%"
height="100">
<tr><td>
This background is filled up with a pattern image.
</td></tr>
</table>
<!-- Another example on table background using pattrern -->
<table
background="/images/pattern2.gif"
height="100">
<tr><td>
This background is filled up with a pattern image.
</td></tr>
</table>
width="100%"
HTML
HTML
You can put any media file in src attribute. You can try it yourself by
giving various files.
21.1 Attributes:
Following is the list of important attributes for <embed> element.
align - Determines how to align the object. It takes either center, left or
right.
autostart - Indicates if the media should start automatically. Netscape
default is true, Internet Explorer is false.
loop - Specifies if the sound should be played continuously (set loop to
true), a certain number of times (a positive value) or not at all (false).
This is supported by Netscape only.
playcount - Specifies the number of times to play the sound. This is
alternat option for loop if you are usiong IE.
hidden - Defines if the object shows on the page. A false value means
no and true means yes.
height - Height of the object in pixels or en.
width - Width of the object in pixels or en.
pluginspage - Specifies the URL to get the plugin software.
name - A name used to reference the object.
HTML
src - URL of the object to be embedded. This can be any recognizable
by the user's browser. It could be .mid, .wav, .mp3, .avi and so on).
volume - Controls volume of the sound. Can be from 0 (off) to 100 (full
volume). This attribute is supported by Netscape only.
src="yourimage.gif"
alt="yourimage.gif"
/></noembed>
</embed>
This will produce following result. Select a picture and paint it using virtual
bursh.
HTML
src="yourimage.gif"
alt="yourimage.gif"
/></noembed>
</bgsound>
This will produce blank screen. This tag does not display any
component and remains hidden.
HTML
Currently, Internet Explorer can handle three different sound format
files: wav, the native format for PCs; au, the native format for most Unix
workstations; and MIDI, a universal music-encoding scheme.
Here alt attribute will come into picture if browser does not support object tag.
You can embed a PDF document in an HTML document as follows:
<object data="data/test.htm" type="application/pdf"
width="300" height="200">
alt : <a href="data/test.pdf">test.pdf</a>
</object>
HTML
You can specify some parameters related to the document with the
param tag. IE sometimes needs a src parameter to understand the location. Here
is an exmaple to embed a wav file:
<object type="audio/x-wav" data="data/test.wav"
width="200" height="20">
<param name="src" value="data/test.wav">
<param name="autoplay" value="false">
<param name="autoStart" value="0">
alt : <a href="data/test.wav">test.wav</a>
</object>
HTML
The classid attribute identifies which version of Java Plug-in to use. You
can use the optional codebase attribute to specify if and how to download the
JRE.
For a complete list of attributes of this object please check HTML Object Tag.
Just like any referenced document, the server delivers the desired
multimedia object to the browser when the user selects the link. If the browser
finds that the document is not HTML or XHTML but rather some other format,
it automatically invokes an appropriate rendering tool to display or otherwise
convey the contents of the object to the user.
Browsers identify and specially handle multimedia files from one of
two different hints: either from the file's Multipurpose Internet Mail Extension
(MIME) type, provided by the server, or from a special suffix in the file's name.
Prepared by HEERA SINGH .T
127
HTML
The browser prefers MIME because of its richer description of the file and its
contents, but it will infer the file's contents (type and format) from the file
suffix: .gif or .jpg, for GIF and JPEG encoded images, for example, or .au for a
special sound file.
22.HTML Styles
Style sheets describe how documents are presented on screens, in print,
or perhaps how they are pronounced. W3C has actively promoted the use of
style sheets on the Web since the Consortium was founded in 1994.
Cascading Style Sheets (CSS) is a style sheet mechanism that has been
specifically developed to meet the needs of Web designers and users.
HTML
With CSS, you can specify a number of style properties for a given
HTML element. Each property has a name and a value, separated by a colon (:).
Each property declaration is separated by a semi-colon (;).
<p style="color:red;font-size:24px;">Using Style Sheet Rules</p>
HTML
body{background-color: pink;}
p{color:blue; 20px;font-size:24px;}
</style>
</head>
HTML
23.HTML Scripts
A script is a small piece of program that can add interactivity to your
website. For example, a script could generate a pop-up alert box message, or
provide a dropdown menu. This script could be Javascript or VBScript.
You can write your Event Handlers using any of the scripting language
and then you can trigger those functions using HTML attributes.
There are two ways of using a style sheet in an HTML document:
<head>
<script src="yourfile.js" type="text/javascript" />
</head>
HTML
<head>
<title>Internal Script</title>
</head>
<body>
<script type="text/javascript">
document.write("Hello Javascript!")
</script>
</body>
<head>
<title>Event Handler Example t</title>
<script type="text/javascript">
function myAlert()
{
alert("I am an event handler....");
return;
}
</script>
</head>
Prepared by HEERA SINGH .T
132
HTML
<body>
<span onmouseover="myAlert();">
Bring your mouse here to see an alert
</span>
</body>
Now this will produce following result. Bring your mouse over this line
and see the result:
Bring your mouse here to see an alert
HTML
'-->
</script>
HTML
Note that you can still override the default by specifying a language
within the script tag.