影响的IE版本
在黔西等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都做网站、成都网站设计 网站设计制作按需规划网站,公司网站建设,企业网站建设,成都品牌网站建设,全网营销推广,成都外贸网站建设公司,黔西网站建设费用合理。
这个 bug 影响 IE7、IE6
表现
跟随在其他浮动元素之后的浮动元素,设置clear属性时不能正确伸缩
教程编写时间
2009.8.18 21:17:12
描述
这是我在 Gérard Talbot 收集整理的 IE7 Bug 页面发现的bug之一(我大部分案例都是从那来的)。这个bug影响IE7跟IE6,表现就是设置了 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中可以发现第二、第三个
我的演示中既有
解决方案
以下是上述bug的解决方法(以类型排序)
解决方法(对清除进行标记)
该方法的时间
Tue Aug 18 21:17:26 2009
可修复的的版本
所有受该bug影响的版本
描述
我找不到一个像样的办法,如果谁有比较好的、相对简洁的办法,请评论给我!下面是我的方法:
修复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),然后设置其display属性为block。
因为
在正常的浏览器里,最初的示例中浮动元素的伸缩可以完全适应其包围元素的变化,而我们的修复版本并不能做到。因而这个解决方法并不完美,不过也许可以帮助到你。
文章题目:IE CSS Bug系列:不正确的浮动伸缩Bug
当前路径:http://www.shufengxianlan.com/qtweb/news45/489195.html
网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联