CSS橫向菜單下拉顯示子功能表

來源:互聯網
上載者:User
<!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" />
<style type="text/css">
*{
font:12px/1.5 Helvetica;
padding:0;
margin:0 auto;
}
#menu{
width:500px;
height:28px;
margin:0 auto;
border-bottom:2px solid red;
}
#menu ul{
list-style:none;
}

#menu ul li{
float:left;
width:87px;
height:27px;
margin:0 2px;
}
#menu ul li ul{
display:none;
position:absolute;
}
#menu ul li ul li{
float:none;
}
#menu ul li:hover ul{
display:block;
}
</style>
</head>
<body>
<div id="menu">
<ul>
<li><a id="current" href="#">首頁</a></li>
<li><a href="#">網頁版式</a>
<ul>
<li><a href="#">自適應寬度</a></li>
<li><a href="#">固定寬度</a></li>
</ul>
</li>
<li><a href="#">web教程</a>
<ul>
<li><a href="#">新手入門</a></li>
<li><a href="#">視頻教程</a></li>
<li><a href="#">常見問題</a></li>
</ul>
</li>
<li><a href="#">web執行個體</a></li>
<li><a href="#">常用代碼</a></li>
</ul>
</div>
</body>
</html>
<!--margin必須指定寬度和高度時才好用並且兩對象間相鄰的margin值只算外邊框對外邊框的距離等於二者之間最大的margin值-->
相關文章

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.