幾種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>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style>
#nav { height:26px; border-bottom:2px solid #2788da; list-style:none;}
#nav li { float:left;}
#nav li a { color:#000000; text-decoration:none; padding-top:4px; display:block; width:120px; height:22px; text-align:center; background-color:#ececec; margin-left:2px;}
#nav li a:hover { background-color:#bbbbbb; color:#ffffff;}
#nav li a#current { background-color:#2788da; color:#fff;}
</style>
</head>
<body>
  <ul id="nav">
    <li><a id="current" href="/index.asp">首頁</a></li>
    <li><a href="/Sort/List_4.html">DIV+CSS教程</a></li>
    <li><a href="/Sort/List_5.html">常用代碼</a></li>
    <li><a href="/Sort/List_6.html">水晶表徵圖</a></li>
    <li><a href="/Sort/List_7.html">幻燈圖片</a></li>
    <li><a href="/Sort/List_10.html">軟體下載</a></li>
    <li><a href="/css2/">CSS2.0實用手冊</a></li>
  </ul>
</body>
</html>

 

 

 

 

縱向:<!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>縱嚮導航菜單</title>
<style>
#nav { width:100px; border-color:#c5c6c4; border-style:solid; border-width:0px 1px 1px 1px;}
#nav h1 { margin:0px; padding:4px; font-size:12px; font-weight:bold; font-family:Verdana; border-top:1px solid #c5c6c4; background-color:#CCCCCC;}
#nav h2 { margin:0px; padding:4px; font-size:12px; font-family:Verdana; font-weight:normal;}
#nav h2 a { color:#666666; text-decoration:none;}
#nav h2 a:hover { color:#999999; text-decoration:underline;}

</style>
</head>

<body>
<div id="nav">
 <h1>CSS</h1>
  <h2><a href="#">css入門</a></h2>
  <h2><a href="#">css進階</a></h2>
  <h2><a href="#">css進階</a></h2>
 <h1>webUI</h1>
  <h2><a href="#">理論知識</a></h2>
  <h2><a href="#">實戰應用</a></h2>
  <h2><a href="#">進階技巧</a></h2>
 <h1>DOM</h1>
  <h2><a href="#">DOM入門</a></h2>
  <h2><a href="#">DOM應用</a></h2>
  <h2><a href="#">DOM與瀏覽器</a></h2>
 <h1>XHTML</h1>
  <h2><a href="#">參考手冊</a></h2>
  <h2><a href="#">交流論壇</a></h2>
</div>
</body>
</html>

 

 

下拉:

<!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>下拉及多級彈出式菜單www.aa25.cn</title>
<script type="text/javascript"><!--//--><![CDATA[//><!--
startList = function() {
 if (document.all&&document.getElementById) {
  navRoot = document.getElementById("nav");
  for (i=0; i<navRoot.childNodes.length; i++) {
   node = navRoot.childNodes[i];
   if (node.nodeName=="LI") {
    node.onmouseover=function() {
     this.className+=" over";
    }
    node.onmouseout=function() {
     this.className=this.className.replace(" over", "");
    }
   }
  }
 }
}
window.onload=startList;

//--><!]]></script>
<style>
ul { padding:0; margin:0; list-style:none;}
li { float:left; width:100px;}
ul li a { display:block; font-size:12px; border:1px solid #ccc; margin-top:2px; margin-left:3px; padding:3px; text-decoration:none; color:#777;}
ul li a:hover { background-color:#ddd;}
li ul { display:none; top:20px;}
li:hover ul,li.over ul { display:block;}
</style>
</head>

<body>
<ul id="nav">
 <li><a href="">文章</a>
  <ul>
   <li><a href="">CSS教程</a></li>
   <li><a href="">DOM教程</a></li>
   <li><a href="">XML教程</a></li>
   <li><a href="">FLASH教程</a></li>
  </ul>
 </li>
 <li><a href="">參考</a>
  <ul>
   <li><a href="">XHTML</a></li>
   <li><a href="">XML</a></li>
   <li><a href="">CSS</a></li>
  </ul>
 </li>
 <li><a href="">BLOG</a>
  <ul>
   <li><a href="">全部</a></li>
   <li><a href="">網頁技術</a></li>
   <li><a href="">UI技術</a></li>
   <li><a href="">FLASH技術</a></li>
  </ul>
 </li>
</ul>
<ul>
 <li><a href="">搖滾</a></li>
 <li><a href="">純音樂</a></li>
 <li><a href="">古典金曲</a></li>
 <li><a href="">電影原聲</a></li>
</ul>
</body>
</html>

相關文章

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.