DIV CSS列形導航一例,超酷解析!

來源:互聯網
上載者:User

核心提示:DIV CSS列形導航一例,超酷解析!

如圖效果:

先看看XHTML代碼:

<ul id="navlist"> <li id="active">Item one <ul id="subnavlist"> <li id="subactive">Subitem one</li> <li>Subitem two</li> <li>Subitem three</li> <li>Subitem four</li> </ul> </li> <li>Item two</li> <li>Item three</li> <li>Item four</li> </ul>

看看CSS是如何定久相關元素的:

#navcontainer { margin-left: 30px; } <br/><br/>#navcontainer ul <br/>{ <br/>margin: 0; <br/>padding: 0; <br/>list-style-type: none; <br/>font-family: verdana, arial, Helvetica, sans-serif; <br/>} <br/><br/>#navcontainer li { margin: 0; } <br/><br/>#navcontainer a <br/>{ <br/>display: block; <br/>padding: 5px 10px; <br/>width: 140px; <br/>color: #000; <br/>background-color: #ADC1AD; <br/>text-decoration: none; <br/>border-top: 1px solid #fff; <br/>border-left: 1px solid #fff; <br/>border-bottom: 1px solid #333; <br/>border-right: 1px solid #333; <br/>font-weight: bold; <br/>font-size: .8em; <br/>background-image: url(images/vertical06.jpg); <br/>background-repeat: no-repeat; <br/>background-position: 0 0; <br/>} <br/><br/>#navcontainer a:hover <br/>{ <br/>color: #000; <br/>background-color: #889E88; <br/>text-decoration: none; <br/>border-top: 1px solid #333; <br/>border-left: 1px solid #333; <br/>border-bottom: 1px solid #fff; <br/>border-right: 1px solid #fff; <br/>background-image: url(images/vertical06a.jpg); <br/>background-repeat: no-repeat; <br/>background-position: 0 0; <br/>} <br/><br/>#navcontainer ul ul li { margin: 0; } <br/><br/>#navcontainer ul ul a <br/>{ <br/>display: block; <br/>padding: 5px 5px 5px 30px; <br/>width: 125px; <br/>color: #000; <br/>background-color: #C5D8C5; <br/>text-decoration: none; <br/>font-weight: normal; <br/>} <br/><br/>#navcontainer ul ul a:hover <br/>{ <br/>color: #000; <br/>background-color: #889E88; <br/>text-decoration: none; <br/>}



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.