新聞中心
影響的IE版本

在黔西等地區(qū),都構(gòu)建了全面的區(qū)域性戰(zhàn)略布局,加強發(fā)展的系統(tǒng)性、市場前瞻性、產(chǎn)品創(chuàng)新能力,以專注、極致的服務(wù)理念,為客戶提供成都做網(wǎng)站、成都網(wǎng)站設(shè)計 網(wǎng)站設(shè)計制作按需規(guī)劃網(wǎng)站,公司網(wǎng)站建設(shè),企業(yè)網(wǎng)站建設(shè),成都品牌網(wǎng)站建設(shè),全網(wǎng)營銷推廣,成都外貿(mào)網(wǎng)站建設(shè)公司,黔西網(wǎng)站建設(shè)費用合理。
這個 bug 影響 IE7、IE6
表現(xiàn)
跟隨在其他浮動元素之后的浮動元素,設(shè)置clear屬性時不能正確伸縮
教程編寫時間
2009.8.18 21:17:12
描述
這是我在 Gérard Talbot 收集整理的 IE7 Bug 頁面發(fā)現(xiàn)的bug之一(我大部分案例都是從那來的)。這個bug影響IE7跟IE6,表現(xiàn)就是設(shè)置了 clear 屬性的浮動元素并不能正確地伸縮。我們來看一下:
演示
示例在這個獨立頁面
HTML代碼:
- Here is a <div> having float: left and clear: left. As expected,
- it takes, it occupies as much width it requires from the body's content
- area.
- This is the same type of <div>: a left-floated <div> with
- clear: left. This <div> should use, should take, should occupy
- the whole content area of the body node (expected results). However, in
- Internet Explorer 7, this left-floated <div> with clear: left only
- takes, only occupies a very narrow chunk of the body's content area
- (actual results). More text filling. More text filling. More text
- filling. More text filling. More text filling.
- Here, a third <div> having float: left and clear: left. Change
- your browser window viewport's width.
- Here is a <div> having float: left and clear: left. As expected,
- it takes, it occupies as much width it requires from the body's content
- area.
- This is the same type of <div>: a left-floated <div> with
- clear: left. This <div> should use, should take, should occupy
- the whole content area of the body node (expected results). However, in
- Internet Explorer 7, this left-floated <div> with clear: left only
- takes, only occupies a very narrow chunk of the body's content area
- (actual results). More text filling. More text filling. More text
- filling. More text filling. More text filling.
- Here, a third <div> having float: left and clear: left. Change
- your browser window viewport's width.
CSS 代碼:
- div, li {
- background-color: #ddd;
- border: 1px solid green;
- clear: left;
- color: black;
- float: left;
- }
在IE6跟IE7中可以發(fā)現(xiàn)第二、第三個
我的演示中既有
解決方案
以下是上述bug的解決方法(以類型排序)
解決方法(對清除進行標(biāo)記)
該方法的時間
Tue Aug 18 21:17:26 2009
可修復(fù)的的版本
所有受該bug影響的版本
描述
我找不到一個像樣的辦法,如果誰有比較好的、相對簡潔的辦法,請評論給我!下面是我的方法:
修復(fù)bug的演示在這個獨立頁面
HTML Code:
- Here is a <div> having float: left and clear: left. As expected,
- it takes, it occupies as much width it requires from the body's content
- area.
- This is the same type of <div>: a left-floated <div> with
- clear: left. This <div> should use, should take, should occupy
- the whole content area of the body node (expected results). However, in
- Internet Explorer 7, this left-floated <div> with clear: left only
- takes, only occupies a very narrow chunk of the body's content area
- (actual results). More text filling. More text filling. More text
- filling. More text filling. More text filling.
- Here, a third <div> having float: left and clear: left. Change
- your browser window viewport's width.
Here is a <div> having float: left and clear: left. As expected,- it takes, it occupies as much width it requires from the body's content
- area.
CSS Code:
- div {
- background-color: #ddd;
- border: 1px solid green;
- clear: left;
- color: black;
- float: left;
- }
- .ie_fix { display: inline-block; }
- .ie_fix { display: block; }
看下這邊我做的事。在示例中的div部分,我在各div之間插入一個額外的元素,并且通過 {display: inline-block;}給它一個”布局”(layout),然后設(shè)置其display屬性為block。
因為
- 部分我將每個
- 的內(nèi)容用一個包起來,然后將那個div設(shè)為浮動(注意這邊將 li 的浮動刪掉了)。
在正常的瀏覽器里,最初的示例中浮動元素的伸縮可以完全適應(yīng)其包圍元素的變化,而我們的修復(fù)版本并不能做到。因而這個解決方法并不完美,不過也許可以幫助到你。
當(dāng)前文章:IE CSS Bug系列:不正確的浮動伸縮Bug
當(dāng)前URL:http://www.5511xx.com/article/cosopjj.html


咨詢
建站咨詢
