dl,dt,dd製作的CSS垂直菜單_經驗交流
來源:互聯網
上載者:User
感覺跟ul和li有點類似,不過也算是一種新思路,源碼如下:
<!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=gb2312" /> <title>dl,dt,dd製作的CSS垂直菜單</title> <style type="text/css"> #menu dl {width: 150px; margin: 0 auto; padding: 0 0 10px 0; background: #69c url(file:///E|/ceshi/media/bottom.gif) no-repeat bottom left;} #menu dt {margin:0; padding: 10px; font-size: 1.4em; font-weight:bold; color: #fff; border-bottom:1px solid #fff; background: #69c url(file:///E|/ceshi/media/top.gif) no-repeat top left;} #menu dd {margin:0; padding:0; color: #fff; font-size: 1em; border-bottom:1px solid #fff; background: #47a;} #gallery a, #gallery a:visited {color:#fff; text-decoration:none; display:block; padding:5px 5px 5px 20px; background: #47a url(file:///E|/ceshi/media/arrow.gif) no-repeat 10px 10px; width:125px; } #gallery a:hover {background: #258 url(file:///E|/ceshi/media/arrowr.gif) no-repeat 11px 10px; color:#9cf;} ol li {font-size:11px;} </style> </head> <body> <dl id="gallery"> <dt>Gallery</dt> <dd>Paul Cezanne</dd> <dd>Henri Matisse</dd> <dd>Vincent van Gogh</dd> <dd>William Turner</dd> <dd>John Constable</dd> <dd>Claude Monet</dd> </dl> </body> </html>
[Ctrl+A 全選 注:如需引入外部Js需重新整理才能執行]