一個老外弄的Clearing floats(清除浮動的方法)
更新時間:2007年09月10日 22:16:46 作者:
我常用的都是clear:both;方法,如
<div style="clear:both">
<div style="float:left"></div>
<div style="float:right"></div>
</div>
今在PlanABC看到另外這種方法,特些記錄下來。
div.container {
border: 1px solid #000000;
}
div.left {
width: 45%;
float: left;
}
div.right {
width: 45%;
float: right;
}
層套關(guān)系:container的div包含left和right
最簡單合理的清除浮動的方法(紅色粗體部分):
div.container {
border: 1px solid #000000;
overflow: hidden;
width: 100%;
}
兼容情況:IE6 IE7 FF MacIE等
來源地址:http://www.quirksmode.org/css/clearing.html
PS:不過在使用的過程貌似還有小的BUG,淘寶的小馬曾碰到過,具體的癥狀是,IE6中層套清除浮動的div,導致部分鏈接無法點擊。
<div style="clear:both">
<div style="float:left"></div>
<div style="float:right"></div>
</div>
今在PlanABC看到另外這種方法,特些記錄下來。
div.container {
border: 1px solid #000000;
}
div.left {
width: 45%;
float: left;
}
div.right {
width: 45%;
float: right;
}
層套關(guān)系:container的div包含left和right
最簡單合理的清除浮動的方法(紅色粗體部分):
div.container {
border: 1px solid #000000;
overflow: hidden;
width: 100%;
}
兼容情況:IE6 IE7 FF MacIE等
來源地址:http://www.quirksmode.org/css/clearing.html
PS:不過在使用的過程貌似還有小的BUG,淘寶的小馬曾碰到過,具體的癥狀是,IE6中層套清除浮動的div,導致部分鏈接無法點擊。
相關(guān)文章
css 兼容性問題this.style.cursor=''''hand''''
css 兼容性問題this.style.cursor='hand'讓我們來CSS HACK2008-11-11為了防止亂碼,請將用于頁面編碼的meta charset放到title的前面
為了防止亂碼,請將用于頁面編碼的meta charset放到title的前面...2007-12-12