CSS折疊菜單一例:可自由伸縮折疊_DIV+CSS實例

      編輯Tag賺U幣
      教程Tag:暫無Tag,歡迎添加,賺取U幣!

        CSS折疊菜單我們在實際設計中是經(jīng)常會碰到的。此菜單非常方便,也深受客戶的喜愛,我們今天就介紹一種可自由伸縮折疊的CSS折疊菜單。如下圖:

       


        我們看下面的XHTML代碼:

       

      div css xhtml xml 示例代碼 示例代碼 [www.wf0088.com]
      <div class="curved">
      <b class="b1 c1"></b>
      <b class="b2 c2"></b>
      <b class="b3 c3"></b>
      <b class="b4 c4" ></b>
      <ul id="menu">
      <li>
      <a href="http://www.wf0088.com/?309">
      <b class="h2">我愛MB5U.com - 1</b><br />
      <b class="h3">http://www.wf0088.com/</b>
      <span>CSS模板 符合Web標準<br />CSS酷站 高手的實站經(jīng)驗<br />CSS Web Design<br /> CSS Templates<br />CSS WebSites</span>
      </a>
      </li>
      <li>
      <a href="http://www.wf0088.com/?309">
      <b class="b1"></b>
      <b class="b2"></b>
      <b class="b3"></b>
      <b class="b4"></b>
      <b class="h2">我愛MB5U.com - 2</b><br />
      <b class="h3">http://www.wf0088.com/</b>
      <span>CSS模板 符合Web標準<br />CSS酷站 高手的實站經(jīng)驗<br />CSS Web Design<br /> CSS Templates<br />CSS WebSites</span>
      </a>
      </li>
      <li>
      <a href="http://www.wf0088.com/?309">
      <b class="b1"></b>
      <b class="b2"></b>
      <b class="b3"></b>
      <b class="b4"></b>
      <b class="h2">我愛MB5U.com - 3</b><br />
      <b class="h3">http://www.wf0088.com/</b>
      <span>CSS模板 符合Web標準<br />CSS酷站 高手的實站經(jīng)驗<br />CSS Web Design<br /> CSS Templates<br />CSS WebSites</span>
      </a>
      </li>
      <li>
      <a href="http://www.wf0088.com/?309">
      <b class="b1"></b>
      <b class="b2"></b>
      <b class="b3"></b>
      <b class="b4"></b>
      <b class="h2">我愛MB5U.com - 4</b><br />
      <b class="h3">http://www.wf0088.com/</b>
      <span>CSS模板 符合Web標準<br />CSS酷站 高手的實站經(jīng)驗<br />CSS Web Design<br /> CSS Templates<br />CSS WebSites</span>
      </a>
      </li>
      <li>
      <a class="one" href="http://www.wf0088.com/?309">
      <b class="b1"></b>
      <b class="b2"></b>
      <b class="b3"></b>
      <b class="b4"></b>
      <b class="h2">我愛MB5U.com - 5</b><br />
      <b class="h3">http://www.wf0088.com/</b>
      <span>CSS模板 符合Web標準<br />CSS酷站 高手的實站經(jīng)驗<br />CSS Web Design<br /> CSS Templates<br />CSS WebSites</span>
      </a>
      </li>
      </ul>
      <b class="b4"></b>
      <b class="b3"></b>
      <b class="b2"></b>
      <b class="b1"></b>
      </div>


        我們看下面的CSS代碼:

       

      div css xhtml xml 示例代碼 示例代碼 [www.wf0088.com]
      #menu {
      font-size:12px;
      height:380px;
      margin:0;
      padding:0;
      width:180px;
      overflow:hidden;
      background:#f0f0f0;
      list-style:none;
      border-left:1px solid #cccccc;
      border-right:1px solid #cccccc;
      }
      #menu li a {
      display:block;
      text-decoration:none;
      color:#00f;
      margin:0;
      width:100%;
      }
      #menu li a span {
      display:none;
      color:#666;
      line-height:22px;
      height:126px
      display:block;
      margin-top:12px;
      }
      #menu li a.one span {
      display:block;
      margin:0 10px;
      }
      #menu li a:hover {
      background:#f1f1f1;
      }
      #menu li a:hover span {
      display:block;
      margin:0 10px;
      cursor:pointer;
      }
      #menu .h2 {
      margin:0 5px;
      padding:0;
      color:#00f;
      font-variant:small-caps;
      border:0;
      }
      #menu .h3 {
      margin:0 5px;
      padding:0;
      color:#06c;
      }
      .curved {
      width:180px;
      margin:0 auto;
      }
      .curved .b1, .curved .b2, .curved .b3, .curved .b4 {
      font-size:1px;
      display:block;
      background:#88c;
      overflow: hidden;
      }
      .curved .b1, .curved .b2, .curved .b3 {
      height:1px;
      }
      .curved .b2, .curved .b3, .curved .b4 {
      background:#f0f0f0;
      border-left:1px solid #cccccc;
      border-right:1px solid #cccccc;
      }
      .curved .b1 {
      margin:0 4px;
      background:#cccccc;
      }
      .curved .b2 {
      margin:0 2px;
      border-width:0 2px;
      }
      .curved .b3 {
      margin:0 1px;
      }
      .curved .b4 {
      height:2px;
      margin:0px;
      }


        我們最終的運行效果:

       

      div css xhtml xml 代碼調(diào)試框 代碼調(diào)試框 [www.wf0088.com]

      [ 可先修改部分代碼 再運行查看效果 ]


        希望此菜單對你的工作學習有所幫助!

      來源:無憂整理//所屬分類:DIV+CSS實例/更新時間:2007-03-18
      相關DIV+CSS實例