先看圖(圖片只是大致做了一下)
效果展示:
運行代碼框
<!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>菜單</li> <li>菜單</li> <li>菜單</li> </ul> </body> </html>
[Ctrl+A 全選 注:如需引入外部Js需重新整理才能執行]