Template Categories

templates categories Automobiles
templates categories Business
templates categories CSS Templates
templates categories E-Commerce
templates categories Education
templates categories Fashion
templates categories Greeting Cards
templates categories Hotels
templates categories Jewelry
templates categories kids
templates categories Models
templates categories Music - Films
templates categories Night Club
templates categories Real Estate
templates categories Restaurant
templates categories Software
templates categories Sports
templates categories Travel
templates categories Web-design
templates categories Wedding

Tutorial Categories

tutorial categories AJAX
tutorial categories CSS
tutorial categories Dreamweaver
tutorial categories Flash
tutorial categories FTP - File Transfer
tutorial categories HTML Emails
tutorial categories Javascript
tutorial categories Microsoft Excel
tutorial categories Microsoft Windows
tutorial categories Microsoft Word
tutorial categories MySql
tutorial categories Photoshop
tutorial categories Php
tutorial categories Windows Movie Maker
tutorial categories Xhtml / Html
Creating CSS menu / hover using single image

CREATE CSS MENU - HOVER SINGLE IMAGE

We will use the following image to create hover effect. The dimensions of this image are 974px X 200px. Basically, this is more of a code snippet than a tutorial. One thing to remember is the a:hover background position. You have to go on adding the width of a single piano ( which in this case is 97px ) for every subsequent hover.
hover-image

The HTML code

<ul>
<li><a id="menu1" title="menu1" accesskey="1" href="#"></a></li>
<li><a id="menu2" title="menu2" accesskey="2" href="#"></a></li>
<li><a id="menu3" title="menu3" accesskey="3" href="#"></a></li>
<li><a id="menu4" title="menu4" accesskey="4" href="#"></a></li>
<li><a id="menu5" title="menu5" accesskey="5" href="#"></a></li>
</ul>

The CSS code

<style>
ul, li {
list-style-type: none;
margin:0;
padding:0;
}
ul {
position: absolute;
left: 50px;
top: 50px;
background: transparent url(piano.jpg) top left no-repeat;
height: 200px;
width: 487px;
text-align: center;
border: 1px solid #555;
}
li {
display: inline;
}

li a {
display: block;
height: 200px;
width: 97px;
line-height: 40px;
color: #ECEC00;
font-size: 18px;
font-family: verdana,georgia, serif;
text-decoration: none;
float:left;
}
li a:hover {
color: #43271B;
background: transparent url(piano.jpg) top left no-repeat;
}
a#menu1:hover {
background-position: -487px 0% ;/* move of background for each button */
}
a#menu2:hover {
background-position: -584px 0% ;
}
a#menu3:hover {
background-position: -681px 0% ;
}
a#menu4:hover {
background-position: -778px 0% ;
}
a#menu5:hover {
background-position: -876px 0% ;
}
</style>

Hope you have enjoyed this tutorial on creating horizontal menu in CSS using single image for hover effect. SEE THE MENU IN ACTION