先看图(图片只是大致做了一下)
效果展示:
运行代码框
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> <html xmlns=”http://www.w3.org/1999/xhtml”> <head> <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ /> <meta name=”author” content=”Linxz” /> <title>无标题文档</title> <style type=”text/css”> * {margin:0;padding:0;font:normal 12px/25px “宋体”;} body {background:#f8f8f8;} ul {list-style:none;width:300px;height:25px;margin:20px auto;} li {float:left;width:86px;height:25px;text-align:center;margin:0 -5px;display:inline;} a {color:#fff; float:left;width:86px;height:25px;top:0;left:0;background:url(/articleimg/2008/04/5627/03.gif) center center no-repeat;} a:hover {color:#000;background:url(/articleimg/2008/04/5627/02.gif) 0 0 no-repeat;width:86px;position:relative;} </style> </head> <body> <ul> <li><a href=”#” title=”菜单”>菜单</a></li> <li><a href=”#” title=”菜单”>菜单</a></li> <li><a href=”#” title=”菜单”>菜单</a></li> </ul> </body> </html>
[Ctrl+A 全选 注:引入外部Js需再刷新一下页面才能执行]