CSS to implement navigation bar image Flip Menu

Source: Internet
Author: User
Tags image flip implement
css| Menu | navigation

If the traditional method of making this flip menu, at least need to cut the picture into 10 pieces, but also to add JS code, in the Picture button to add behavior, now completely with CSS to achieve, the picture as long as a, see the following figure:

  CSS code:

#imgmenu {
width:450px;
height:25px; /* height is half of the background picture * *
Background:url (/imagelist/06/43/473648jpj0j1.gif);
List-style-type:none;
padding:0px;
margin:0px;
}
#imgmenu li{
Float:left;
}
#imgmenu Li a{
Display:block;
width:90px;
height:25px;
}
#imgmenu li#home A:hover, #activeh {
Background:url (/imagelist/06/43/473648jpj0j1.gif) 0-25px;
/* Flip the position of the background image, left 0px, top -25px,
The lower part of the background image, hereinafter * * *
}
#imgmenu li#about A:hover, #activea {
Background:url (/imagelist/06/43/473648jpj0j1.gif) -90px-25px;
/* The position of the second menu is 90px from the left.
The width of each menu is 90px*/
}
#imgmenu Li#pro A:hover, #activep {
Background:url (/imagelist/06/43/473648jpj0j1.gif) -180px-25px;
}
#imgmenu Li#faq A:hover, #activef {
Background:url (/imagelist/06/43/473648jpj0j1.gif) -270px-25px;
}
#imgmenu li#contact A:hover, #activec {
Background:url (/imagelist/06/43/473648jpj0j1.gif) -360px-25px;
}<ul id= "Imgmenu" >
<li id= "Activeh" ><a href= "#" ></a></li>

<li id= "about" ><a href= "#" ></a></li>
<li id= "Pro" ><a href= "#" ></a></li><li id= "FAQ" ><a href= "#" ></a></li >

<li id= "Contact" ><a href= "#" ></a></li></ul>

Designed to be more considerate, take care of the plain text browsing friends:

You can set the span element inside Li, add text links, and make span invisible in style.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.