« createElement方法asp调用Excel数据 »

float: right bug in IE float: right 在IE 中引起的bug

From: http://www.jluvip.com/blog/article.asp?id=245

"float: right" bug 在IE中float-right外围容器的margin-left失效.

css :

body {
 margin: 0px;
}
#contener {
 border: 1px solid #000;
 margin: 10px 50px;/*左右外补丁margin=50px*/
}
#floatRight {
 float: right;
 border: 1px solid red;
 color: red;
 width: 30%;
}
#contenu {
 border: 1px solid blue;
 color: blue;
}
.spacer {
 clear: both;
 border: 1px solid #FF00FF;
 color: #FF00FF;
}


xhtml :

<div id="contener">
 <b>#contener</b>
 <div id="floatRight">
 <b>#floatRight</b> : Float block at the right of the block #contenu
 </div>
 <div id="contenu">
 <b>#contenu</b> : Simple block
 </div>
 <div class='spacer'>
 <b>.spacer</b> : a "spacer" block...
 </div>
</div>

正确应该显示为 :


Internet Explorer 6 显示为:


IE6.0中#contener的margin-left无效!

解决办法:

body {
 margin: 10px 50px; /* 给body增加marign */
}
#contener {
 border: 1px solid #000;
 /* margin: 10px 50px; 取消#contener的margin,也就是给他外围增加margin替代自身margin*/
}
原创文章如转载,请注明:转载自悠悠博客 [ http://www.ajaxstu.com/ ]

相关文章:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。