DIV+CSS排版中製作細線條的三種方法–FOR IE

來源:互聯網
上載者:User
更多CSS布局、網站訪問無障礙化、網站親和力(Accessibility)文章.

如果你要製作一條高度小於12PX(大約)的線條,在IE中會顯示出高於實際高度的,看下面。 

.line10{background: #CCCCCC;height: 6px;}

可看出實際高度大於6PX,這也算是IE的一個BUG吧。以下三種方法可解決這個問題,推薦使用第一種方法。

1.

.line11{background: #CCCCCC;height: 6px;overflow: hidden;}
<div class="line11"></div>

2. div之間要加個空格 註:IE5.0 無效

 
.line12{background: #336699;line-height: 6px;}
<div class="line12">&nbsp;</div>

3.

.line13{background: #CC0000;height: 6px;font-size: 1px;}
<div class="line13"></div>
相關文章

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.