選項卡這樣寫更靈活,選項卡寫更靈活

來源:互聯網
上載者:User

選項卡這樣寫更靈活,選項卡寫更靈活

同樣的html代碼結構 配合不同的css代碼 展示不一樣的效果。

html基本結構

12345678910 <div id="tabs" class="tabs_right">    <ul >        <li><a href=#tab1>土豪</a></li>        <li><a href=#tab2>官二代</a></li>        <li><a href=#tab3>富二代</a></li>    </ul>    <div id="tab1" class="tabsCont" >Contents of first tab</div>    <div id="tab2" class="tabsCont">div>    <div id="tab3" class="tabsCont">div></div>

css代碼1

123456789101112131415161718192021222324 .tabs{    width:400px;    height:auto;}.tabs>ul{width:100%;height:auto;background-color:#ededed;padding:0;height:36px; }.tabs>ul>li{float:left;padding:0 10px;height:30px;line-height:30px;list-style:none;margin:6px 5px 0 5px;background-color:#d8d8d8;}.tabs>ul>li>a{color:#000;}

 效果如下

css代碼2

123456789101112131415161718192021222324252627282930 .tabs_bottom{    width:400px;    height:auto;    border:1px solid #ededed;    min-height:200px;    position:relative;}.tabs_bottom>ul{    width:100%;    height:auto;    background-color:#ededed;    padding:0;    margin:0;    height:36px;    position:absolute;    bottom:0; }.tabs_bottom>ul>li{float:left;padding:0 10px;height:30px;line-height:30px;list-style:none;margin:6px 5px 0 5px;background-color:#d8d8d8;}.tabs_bottom>ul>li>a{color:#000;}

效果如下

 

 css代碼3

123456789101112131415161718192021222324252627282930313233 .tabs_left{    width:400px;    height:auto;    border:1px solid #ededed;    min-height:200px; }.tabs_left>ul{    float:left;    width:100px;    height:auto;    background-color:#ededed;    padding:0;    margin:0;  }.tabs_left>.tabsCont{    float:left;}.tabs_left>ul>li{ padding:0 10px;height:30px;line-height:30px;list-style:none;margin:6px 5px 0 5px;background-color:#d8d8d8;} .tabs_left>ul>li>a{color:#000;}

  效果如下

css代碼4

123456789101112131415161718192021222324252627282930313233 .tabs_right{    width:400px;    height:auto;    border:1px solid #ededed;    min-height:200px; }.tabs_right>ul{    float:right;    width:100px;    height:auto;    background-color:#ededed;    padding:0;    margin:0;  }.tabs_right>.tabsCont{    float:right;}.tabs_right>ul>li{ padding:0 10px;height:30px;line-height:30px;list-style:none;margin:6px 5px 0 5px;background-color:#d8d8d8;} .tabs_right>ul>li>a{color:#000;}

  效果如下

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.