Css uses a background image to implement the effect of a navigation menu with a background image

Source: Internet
Author: User
Tip: you can modify some code before running

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.111cn.net/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"/> <title>Css achieves navigation menu with background image effect</title> <style> ul,li{ list-style:none; float:left;} body{ font-size:12px; line-height:1.6; font-family:Verdana, "宋体", Arial; text-align:center;} #info li{ margin-left:4px; margin-top:15px;} #info a {display:block;text-align:center; padding-left:15px; padding-top:2px;padding-bottom:1px;background-image: url(/upload/201007/20100714195929854.gif); background-repeat: no-repeat;color: #000; width:47px; cursor:hand; text-decoration: none;} #job a:link,#job a:visited{background-position: -62px 0px;} #eve a:link,#eve a:visited{background-position: -124px 0px;} #oth a:link,#oth a:visited{background-position: -186px 0px;} #car a:hover ,#car a:active {background-position: 0px -22px; color:#fff;} #job a:hover ,#car a:active {background-position: -62px -22px; color:#fff;} #eve a:hover ,#car a:active {background-position: -124px -22px; color:#fff;} #oth a:hover ,#car a:active {background-position: -186px -22px; color:#fff;} </style> </head> <body>Webpage creation tutorials, high-quality webpage special effects and advertisement code essential for webmasters. 111cn.net, special js effects for webmasters.<hr> <div id="info"> <ul> <li id="car">Homepage</li> <li id="job">Zz</li> <li id="eve">Special effects</li> <li id="oth">Webmaster</li> </ul> </div> </body> </html>
Tip: you can modify some code before running
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.