
<div class="table"> <ul class="nav"> <li class="active">房產(chǎn)</li> <li>家居</li> <li>二手房</li> </ul> <div class="page"></div> //CSS中設(shè)置display:none; 隱藏 <div class="page-hide"></div> //CSS中設(shè)置display:block; 出現(xiàn)</div>css :
![]() .tab-list{ //最外的框 width: 273px; height: 153px; border: 1px solid black; background-color: #ddd; }.nav{ //上標(biāo)題欄 height: 32px; border-bottom: 2px solid red; }.nav li{ //每個(gè)標(biāo)題 display: inline-block; height: 30px;line-height:30px; width: 60px; border:1px solid blue;}.nav .active{ border-top: 2px solid yellow; border-bottom: 2px solid #fff; } 設(shè)置active的border,此時(shí)右邊兩個(gè)標(biāo)題會(huì)被一起撐下來(border是加在內(nèi)容寬度上面的。) |
|
效果如左圖問題:第二行開始border總是不能連續(xù);原因:使用display:inline-block時(shí)vertical-algin候默認(rèn)為baseline |
|
![]() | |
![]() | ![]() |
| #columnContent .item_ul>li { float:left; width:203px; margin:3px 5px; vertical-align:top; text-align:left; } 效果:菜單居中和自適應(yīng)問題:整體樣式?jīng)]問題,但是展開li標(biāo)簽內(nèi)容時(shí),其他li標(biāo)簽環(huán)繞, 又因?yàn)榇嬖谧赃m應(yīng),當(dāng)頁面縮小時(shí),每行的li標(biāo)簽個(gè)數(shù)會(huì)減少,并且居中 | #columnContent .item_ul>li { display:inline-block; width:203px; margin:3px 5px; vertical-align:top; text-align:left; *display:inline; zoom:1; } 只需替換一個(gè)浮動(dòng)樣式就都解決了。 |
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注