【IE BUG】 CSS/HTML解决在IE6浏览器下显示文字重复

来源:互联网 发布:软件停服通知 编辑:程序博客网 时间:2024/05/01 02:58

发生条件:

CSS中用了float属性,并且用了html注释<!-- 注释 -->,

补充说明:这个多文字bug在IE7和还在处于beta版的IE8已经得到解决。

代码: <div style="width:200px;">        <div style="float:left;"></div><!-- 在IE6下数一下有多少个前 -->        <div style="float:left;width:200px;">前前前前前</div>        <div style="clear:both;"></div></div> 会多出现一个 前

解决方法一:在父级容器加入:display:inline;

<div style="width:200px;display:inline;">        <div style="float:left;"></div><!-- 在IE6下数一下有多少个前 -->        <div style="float:left;width:200px;">前前前前前</div>        <div style="clear:both;"></div></div>


解决方法二:在子级容器去掉注释

<div style="width:200px;">        <div style="float:left;"></div>        <div style="float:left;width:200px;">前前前前前</div>        <div style="clear:both;"></div></div>




原创粉丝点击