You are on page 1of 27

HTML Forms and Input

« Previous Next Chapter »

HTML Forms are used to select different kinds of user input.

Try-It-Yourself Examples
Text fields
This example demonstrates how to create text fields on an HTML page. A user can write text in
a text field.
Password fields
This example demonstrates how to create a password field on an HTML page.
(You can find more examples at the bottom of this page)

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, textarea
fields, drop-down menus, radio buttons, checkboxes, etc.) in a form.
A form is defined with the <form> tag.
<form>
.
input elements
.
</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 types are explained below.
Text Fields
Text fields are 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:
Top of Form

First name:

Last name:
Bottom of Form

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
</form>
How it looks in a browser:
Top of Form

Male

Female
Bottom of Form

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" />
</form>
How it looks in a browser:
Top of Form
I have a bike:

I have a car:

I have an airplane:
Bottom of Form

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 the server. 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_submit.asp" method="get">
Username:
<input type="text" name="user" />
<input type="submit" value="Submit" />
</form>
How it looks in a browser:
Top of Form

Submit

Username:
Bottom of Form

If you type some characters in the text field above, and click the "Submit" button, the browser
will send your input to a page called "html_form_submit.asp". The page will show you the
received input.
HTML Basic Document
<html>
<head>
<title>Document name goes here</title>
</head>
<body>
Visible text goes here
</body>
</html>
Heading Elements
<h1>Largest Heading</h1>
<h2> . . . </h2>
<h3> . . . </h3>
<h4> . . . </h4>
<h5> . . . </h5>
<h6>Smallest Heading</h6>
Text Elements
<p>This is a paragraph</p>
<br> (line break)
<hr> (horizontal rule)
<pre>This text is preformatted</pre>
Logical Styles
<em>This text is emphasized</em>
<strong>This text is strong</strong>
<code>This is some computer code</code>
Physical Styles
<b>This text is bold</b>
<i>This text is italic</i>
Links, Anchors, and Image Elements
<a href="http://www.example.com/">This is a Link</a>
<a href="http://www.example.com/"><img src="URL" alt="Alternate Text"></a>
<a href="mailto:webmaster@example.com">Send e-mail</a>
A named anchor:
<a name="tips">Useful Tips Section</a>
<a href="#tips">Jump to the Useful Tips Section</a>
Unordered list
<ul>
<li>First item</li>
<li>Next item</li>
</ul>
Ordered list
<ol>
<li>First item</li>
<li>Next item</li>
</ol>
Definition list
<dl>
<dt>First term</dt>
<dd>Definition</dd>
<dt>Next term</dt>
<dd>Definition</dd>
</dl>
Tables
<table border="1">
<tr>
<th>someheader</th>
<th>someheader</th>
</tr>
<tr>
<td>sometext</td>
<td>sometext</td>
</tr>
</table>
Frames
<frameset cols="25%,75%">
<frame src="page1.htm">
<frame src="page2.htm">
</frameset>
Forms
<form action="http://www.example.com/test.asp" method="post/get">
<input type="text" name="lastname" value="Nixon" size="30" maxlength="50">
<input type="password">
<input type="checkbox" checked="checked">
<input type="radio" checked="checked">
<input type="submit">
<input type="reset">
<input type="hidden">

<select>
<option>Apples
<option selected>Bananas
<option>Cherries
</select>
<textarea name="Comment" rows="60" cols="20"></textarea>

</form>
Entities
&lt; is the same as <
&gt; is the same as >
&#169; is the same as ©
Other Elements
<!-- This is a comment -->
<blockquote>
Text quoted from some source.
</blockquote>
<address>
Address 1<br>
Address 2<br>
City<br>
</address>
Source : http://www.w3schools.com/html/html_quick.asp

Commonly Used Character Entities


Note Entity names are case sensitive!
Result Description Entity Name Entity Number
non-breaking space &nbsp; &#160;
< less than &lt; &#60;
> greater than &gt; &#62;
& ampersand &amp; &#38;
¢ cent &cent; &#162;
£ pound &pound; &#163;
¥ yen &yen; &#165;
€ euro &euro; &#8364;
§ section &sect; &#167;
© copyright &copy; &#169;
® registered trademark &reg; &#174;

Ordered Alphabetically
DTD: indicates in which XHTML 1.0 DTD the tag is allowed. S=Strict, T=Transitional, and
F=Frameset
Tag Description DTD
<!--...--> Defines a comment STF
<!DOCTYPE> Defines the document type STF
<a> Defines an anchor STF
<abbr> Defines an abbreviation STF
<acronym> Defines an acronym STF
<address> Defines contact information for the author/owner of a document STF
<applet> Deprecated. Defines an embedded applet TF
<area /> Defines an area inside an image-map STF
<b> Defines bold text STF
<base /> Defines a default address or a default target for all links on a page STF
<basefont /> Deprecated. Defines a default font, color, or size for the text in a page TF
<bdo> Defines the text direction STF
<big> Defines big text STF
<blockquote> Defines a long quotation STF
<body> Defines the document's body STF
<br /> Defines a single line break STF
<button> Defines a push button STF
<caption> Defines a table caption STF
<center> Deprecated. Defines centered text TF
<cite> Defines a citation STF
<code> Defines computer code text STF
<col /> Defines attribute values for one or more columns in a table STF
<colgroup> Defines a group of columns in a table for formatting STF
<dd> Defines a description of a term in a definition list STF
<del> Defines deleted text STF
<dfn> Defines a definition term STF
<dir> Deprecated. Defines a directory list TF
<div> Defines a section in a document STF
<dl> Defines a definition list STF
<dt> Defines a term (an item) in a definition list STF
<em> Defines emphasized text STF
<fieldset> Defines a border around elements in a form STF
<font> Deprecated. Defines font, color, and size for text TF
<form> Defines an HTML form for user input STF
<frame /> Defines a window (a frame) in a frameset F
<frameset> Defines a set of frames F
<h1> to <h6> Defines HTML headings STF
<head> Defines information about the document STF
<hr /> Defines a horizontal line STF
<html> Defines an HTML document STF
<i> Defines italic text STF
<iframe> Defines an inline frame TF
<img /> Defines an image STF
<input /> Defines an input control STF
<ins> Defines inserted text STF
<isindex> Deprecated. Defines a searchable index related to a document TF
<kbd> Defines keyboard text STF
<label> Defines a label for an input element STF
<legend> Defines a caption for a fieldset element STF
<li> Defines a list item STF
<link /> Defines the relationship between a document and an external resource STF
<map> Defines an image-map STF
<menu> Deprecated. Defines a menu list TF
<meta /> Defines metadata about an HTML document STF
<noframes> Defines an alternate content for users that do not support frames TF
<noscript> Defines an alternate content for users that do not support client-side STF
scripts
<object> Defines an embedded object STF
<ol> Defines an ordered list STF
<optgroup> Defines a group of related options in a select list STF
<option> Defines an option in a select list STF
<p> Defines a paragraph STF
<param /> Defines a parameter for an object STF
<pre> Defines preformatted text STF
<q> Defines a short quotation STF
<s> Deprecated. Defines strikethrough text TF
<samp> Defines sample computer code STF
<script> Defines a client-side script STF
<select> Defines a select list (drop-down list) STF
<small> Defines small text STF
<span> Defines a section in a document STF
<strike> Deprecated. Defines strikethrough text TF
<strong> Defines strong text STF
<style> Defines style information for a document STF
<sub> Defines subscripted text STF
<sup> Defines superscripted text STF
<table> Defines a table STF
<tbody> Groups the body content in a table STF
<td> Defines a cell in a table STF
<textarea> Defines a multi-line text input control STF
<tfoot> Groups the footer content in a table STF
<th> Defines a header cell in a table STF
<thead> Groups the header content in a table STF
<title> Defines the title of a document STF
<tr> Defines a row in a table STF
<tt> Defines teletype text STF
<u> Deprecated. Defines underlined text TF
<ul> Defines an unordered list STF
<var> Defines a variable part of a text STF
<xmp> Deprecated. Defines preformatted text

Ordered by Function
DTD: indicates in which XHTML 1.0 DTD the tag is allowed. S=Strict, T=Transitional, and
F=Frameset
Tag Description DTD
Basic
<!DOCTYPE> Defines the document type STF
<html> Defines an HTML document STF
<body> Defines the document's body STF
<h1> to <h6> Defines HTML headings STF
<p> Defines a paragraph STF
<br /> Inserts a single line break STF
<hr /> Defines a horizontal line STF
<!--...--> Defines a comment STF
Formatting
<acronym> Defines an acronym STF
<abbr> Defines an abbreviation STF
<address> Defines contact information for the author/owner of a document STF
<b> Defines bold text STF
<bdo> Defines the text direction STF
<big> Defines big text STF
<blockquote> Defines a long quotation STF
<center> Deprecated. Defines centered text TF
<cite> Defines a citation STF
<code> Defines computer code text STF
<del> Defines deleted text STF
<dfn> Defines a definition term STF
<em> Defines emphasized text STF
<font> Deprecated. Defines font, color, and size for text TF
<i> Defines italic text STF
<ins> Defines inserted text STF
<kbd> Defines keyboard text STF
<pre> Defines preformatted text STF
<q> Defines a short quotation STF
<s> Deprecated. Defines strikethrough text TF
<samp> Defines sample computer code STF
<small> Defines small text STF
<strike> Deprecated. Defines strikethrough text TF
<strong> Defines strong text STF
<sub> Defines subscripted text STF
<sup> Defines superscripted text STF
<tt> Defines teletype text STF
<u> Deprecated. Defines underlined text TF
<var> Defines a variable part of a text STF
<xmp> Deprecated. Defines preformatted text
Forms
<form> Defines an HTML form for user input STF
<input /> Defines an input control STF
<textarea> Defines a multi-line text input control STF
<button> Defines a push button STF
<select> Defines a select list (drop-down list) STF
<optgroup> Defines a group of related options in a select list STF
<option> Defines an option in a select list STF
<label> Defines a label for an input element STF
<fieldset> Defines a border around elements in a form STF
<legend> Defines a caption for a fieldset element STF
<isindex> Deprecated. Defines a searchable index related to a document TF
Frames
<frame /> Defines a window (a frame) in a frameset F
<frameset> Defines a set of frames F
<noframes> Defines an alternate content for users that do not support frames TF
<iframe> Defines an inline frame TF
Images
<img /> Defines an image STF
<map> Defines an image-map STF
<area /> Defines an area inside an image-map STF
Links
<a> Defines an anchor STF
<link /> Defines the relationship between a document and an external resource STF
Lists
<ul> Defines an unordered list STF
<ol> Defines an ordered list STF
<li> Defines a list item STF
<dir> Deprecated. Defines a directory list TF
<dl> Defines a definition list STF
<dt> Defines a term (an item) in a definition list STF
<dd> Defines a description of a term in a definition list STF
<menu> Deprecated. Defines a menu list TF
Tables
<table> Defines a table STF
<caption> Defines a table caption STF
<th> Defines a header cell in a table STF
<tr> Defines a row in a table STF
<td> Defines a cell in a table STF
<thead> Groups the header content in a table STF
<tbody> Groups the body content in a table STF
<tfoot> Groups the footer content in a table STF
<col /> Defines attribute values for one or more columns in a table STF
<colgroup> Defines a group of columns in a table for formatting STF
Styles
<style> Defines style information for a document STF
<div> Defines a section in a document STF
<span> Defines a section in a document STF
Meta Info
<head> Defines information about the document STF
<title> Defines the document title STF
<meta> Defines metadata about an HTML document STF
<base /> Defines a default address or a default target for all links on a page STF
<basefont /> Deprecated. Defines a default font, color, or size for the text in a page TF
Programming
<script> Defines a client-side script STF
<noscript> Defines an alternate content for users that do not support client-side
STF
scripts
<applet> Deprecated. Defines an embedded applet TF
<object> Defines an embedded object STF
<param /> Defines a parameter for an object STF

Styling Links
Links can be style with any CSS property (e.g. color, font-family, background-color).
Special for links are that they can be styled differently depending on what state they are in.
The four links states are:
• a:link - a normal, unvisited link
• a:visited - a link the user has visited
• a:hover - a link when the user mouses over it
• a:active - a link the moment it is clicked

Example
a:link {color:#FF0000} /* unvisited link */
a:visited {color:#00FF00} /* visited link */
a:hover {color:#FF00FF} /* mouse over link */
a:active {color:#0000FF} /* selected link */
a:link {text-decoration:none}
a:visited {text-decoration:none}
a:hover {text-decoration:underline}
a:active {text-decoration:underline}

a:link {background-color:#B2FF99;}
a:visited {background-color:#FFFF85;}
a:hover {background-color:#FF704D;}
a:active {background-color:#FF704D;}

Values for Unordered Lists


Value Description
none No marker
disc Default. The marker is a filled circle
circle The marker is a circle
square The marker is a square

Values for Ordered Lists


Value Description
armenian The marker is traditional Armenian numbering
decimal The marker is a number
decimal-leading-zero The marker is a number padded by initial zeros (01, 02, 03, etc.)
georgian The marker is traditional Georgian numbering (an, ban, gan, etc.)
lower-alpha The marker is lower-alpha (a, b, c, d, e, etc.)
lower-greek The marker is lower-greek (alpha, beta, gamma, etc.)
lower-latin The marker is lower-latin (a, b, c, d, e, etc.)
lower-roman The marker is lower-roman (i, ii, iii, iv, v, etc.)
upper-alpha The marker is upper-alpha (A, B, C, D, E, etc.)
upper-latin The marker is upper-latin (A, B, C, D, E, etc.)
upper-roman The marker is upper-roman (I, II, III, IV, V, etc.)

All CSS List Properties


The number in the "CSS" column indicates in which CSS version the property is defined
(CSS1 or CSS2).
Property Description Values CSS
list-style-type
Sets all the properties for a list in one list-style-position
list-style 1
declaration list-style-image
inherit
URL
list-style-image Specifies an image as the list-item marker none 1
inherit
inside
Specifies if the list-item markers should
list-style-position outside 1
appear inside or outside the content flow
inherit
none
disc
circle
square
decimal
decimal-leading-zero
armenian
georgian
list-style-type Specifies the type of list-item marker 1
lower-alpha
upper-alpha
lower-greek
lower-latin
upper-latin
lower-roman
upper-roman
inherit

All CSS Border Properties


The number in the "CSS" column indicates in which CSS version the property is defined
(CSS1 or CSS2).
Property Description Values CSS
border Sets all the border properties in one border-width 1
declaration border-style
border-color
border-bottom-
width
Sets all the bottom border properties in
border-bottom border-bottom-style 1
one declaration
border-bottom-
color
border-bottom-color Sets the color of the bottom border border-color 2
border-bottom-style Sets the style of the bottom border border-style 2
border-bottom-width Sets the width of the bottom border border-width 1
color_name
hex_number
border-color Sets the color of the four borders rgb_number 1
transparent
inherit
border-left-width
Sets all the left border properties in one
border-left border-left-style 1
declaration
border-left-color
border-left-color Sets the color of the left border border-color 2
border-left-style Sets the style of the left border border-style 2
border-left-width Sets the width of the left border border-width 1
border-right-width
Sets all the right border properties in
border-right border-right-style 1
one declaration
border-right-color
border-right-color Sets the color of the right border border-color 2
border-right-style Sets the style of the right border border-style 2
border-right-width Sets the width of the right border border-width 1
none
hidden
dotted
dashed
solid
border-style Sets the style of the four borders double 1
groove
ridge
inset
outset
inherit
border-top-width
Sets all the top border properties in one
border-top border-top-style 1
declaration
border-top-color
border-top-color Sets the color of the top border border-color 2
border-top-style Sets the style of the top border border-style 2
border-top-width Sets the width of the top border border-width 1
border-width Sets the width of the four borders thin 1
medium
thick
length
inherit

Border Style
The border-style property specifies what kind of border to display.

None of the other border properties will have any effect unless border-style is set.
border-style Values
none: Defines no border
dotted:
dashed:
solid:

double: Defines two borders. The width of the two borders are the same as the border-width
value

groove: Defines a 3D grooved border. The effect depends on the border-color value
ridge: Defines a 3D ridged border. The effect depends on the border-color value

inset: Defines a 3D inset border. The effect depends on the border-color value
outset: Defines a 3D outset border. The effect depends on the border-color value

The CSS Box Model


All HTML elements can be considered as boxes. In CSS, the term "box model" is used when
talking about design and layout.
The CSS box model is essentially a box that wraps around HTML elements, and it consists of:
margins, borders, padding, and the actual content.
The box model allows us to place a border around elements and space elements in relation to
other elements.
The image below illustrates the box model:

Značenje:
• Margin – Predstavlja prostor od okvira (border) do sledećeg elementa. Margina ne može
imati boju, I ona je potpuno transparentna.
• Border - A border that lies around the padding and content. The border is affected by the
background color of the box
• Padding - Clears an area around the content. The padding is affected by the background
color of the box
• Content - The content of the box, where text and images appear
In order to set the width and height of an element correctly in all browsers, you need to know
how the box model works.

Float
<html>

<head>

<style type="text/css">

img

float:left;

}
</style>

</head>

<body>

<p>In the paragraph below, we have added an image with style


<b>float:right</b>. The result is that the image will float to the right in the
paragraph.</p>

<p>

<img src="logocss.gif" width="95" height="84" />

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

</p>

</body>

</html>

<html>

<head>

<style type="text/css">

img
{

float:right;

border:1px dotted red;

margin:0px 0px 15px 20px;

</style>

</head>

<body>

<p>

In the paragraph below, the image will float to the right. A dotted black border is
added to the image.

We have also added margins to the image to push the text away from the image:

0 px margin on the top and right side, 15 px margin on the bottom, and 20 px
margin on the left side of the image.

</p>

<p>

<img src="logocss.gif" width="95" height="84" />

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.


This is some text. This is some text. This is some text.

</p>

</body>

</html>

<html>

<head>

<style type="text/css">

div

float:right;

xwidth:120px;

margin:0 0 15px 20px;

padding:0 0 0 30px;

border:1px solid black;

text-align:center;

</style>

</head>

<body>

<div>

<img src="logocss.gif" width="95" height="84" border="1"/><br />

CSS is fun!

</div>

<p>
This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

</p>

<p>

In the paragraph above, the div element is 120 pixels wide and it contains the
image.

The div element will float to the right.

Margins are added to the div to push the text away from the div.

Borders and padding are added to the div to frame in the picture and the caption.

</p>

</body>

</html>

<html>

<head>
<style type="text/css">

span

float:left;

width:0.7em;

font-size:400%;

font-family:algerian,courier;

line-height:80%;

</style>

</head>

<body>

<p>

<span>T</span>his is some text.

This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

This is some text. This is some text. This is some text.

</p>

<p>

In the paragraph above, the first letter of the text is embedded in a span element.
The span element has a width that is 0.7 times the size of the current font.

The font-size of the span element is 400% (quite large) and the line-height is 80%.

The font of the letter in the span will be in "Algerian".

</p>

</body>

</html>

HORISONTAL MENU:

<html>

<head>

<style type="text/css">

ul

float:left;

width:100%;

padding:0;

margin:0;

list-style-type:none;

float:left;

width:6em;

text-decoration:none;

color:white;

background-color:purple;
padding:0.2em 0.6em;

border-right:1px solid white;

a:hover {background-color:#ff3300}

li {display:inline}

</style>

</head>

<body>

<ul>

<li><a href="#">Link one</a></li>

<li><a href="#">Link two</a></li>

<li><a href="#">Link three</a></li>

<li><a href="#">Link four</a></li>

</ul>

<p>

In the example above, we let the ul element and the a element float to the left.

The li elements will be displayed as inline elements (no line break before or after
the element). This forces the list to be on one line.

The ul element has a width of 100% and each hyperlink in the list has a width of
6em (6 times the size of the current font).

We add some colors and borders to make it more fancy.

</p>

</body>

</html>
-

PAGE WITHOUT TABLE:

<html>

<head>

<style type="text/css">

div.container

width:100%;

margin:0px;

border:1px solid gray;

line-height:150%;

div.header,div.footer

padding:0.5em;

color:white;

background-color:gray;

clear:left;

h1.header

padding:0;

margin:0;

div.left

{
float:left;

width:160px;

margin:0;

padding:1em;

div.content

margin-left:190px;

border-left:1px solid gray;

padding:1em;

</style>

</head>

<body>

<div class="container">

<div class="header"><h1 class="header">W3Schools.com</h1></div>

<div class="left"><p>"Never increase, beyond what is necessary, the number of


entities required to explain anything." William of Ockham (1285-1349)</p></div>

<div class="content">

<h2>Free Web Building Tutorials</h2>

<p>At W3Schools you will find all the Web-building tutorials you need,

from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP.</p>

<p>W3Schools - The Largest Web Developers Site On The Net!</p></div>

<div class="footer">Copyright 1999-2005 by Refsnes Data.</div>

</div>
</body>

</html>

Transparentna slika
<html>
<head>
<style type="text/css">
div.background
{
width:500px;
height:250px;
background:url(klematis.jpg) repeat;
border:2px solid black;
}
div.transbox
{
width:400px;
height:180px;
margin:30px 50px;
background-color:#ffffff;
border:1px solid black;
/* for IE */
filter:alpha(opacity=60);
/* CSS3 standard */
opacity:0.6;
}
div.transbox p
{
margin:30px 40px;
font-weight:bold;
color:#000000;
}
</style>
</head>

<body>

<div class="background">
<div class="transbox">
<p>This is some text that is placed in the transparent box.
This is some text that is placed in the transparent box.
This is some text that is placed in the transparent box.
This is some text that is placed in the transparent box.
This is some text that is placed in the transparent box.
</p>
</div>
</div>

</body>
</html>

AKCIJE : ON MOUSE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>

<head>

<style type="text/css">

#navlist{position:relative;}

#navlist li{margin:0;padding:0;list-style:none;position:absolute;top:0;}

#navlist li, #navlist a{height:44px;display:block;}

#home{left:0px;width:46px;}

#home{background:url('img_navsprites_hover.gif') 0 0;}

#home a:hover{background: url('img_navsprites_hover.gif') 0 -45px;}

#prev{left:63px;width:43px;}

#prev{background:url('img_navsprites_hover.gif') -47px 0;}

#prev a:hover{background: url('img_navsprites_hover.gif') -47px -45px;}

#next{left:129px;width:43px;}

#next{background:url('img_navsprites_hover.gif') -91px 0;}

#next a:hover{background: url('img_navsprites_hover.gif') -91px -45px;}


</style>

</head>

<body>

<ul id="navlist">

<li id="home"><a href="default.asp"></a></li>

<li id="prev"><a href="css_intro.asp"></a></li>

<li id="next"><a href="css_syntax.asp"></a></li>

</ul>

</body>

</html>

You might also like