2010-06-03 65 views
2

我m使用我的网站中的div通过使用float:left和float:之后使用明确:两者,其在所有浏览器工作正常,除ie7我已经尝试了很多的事情,请告诉我一个解决方案来解决这个问题....清除属性不工作ie 7

CSS:

.clear 
{ 
    clear : both; 
    margin : 0px; 

} 

HTML:

<div style="float:left">some text</div> 
<div style="float:left">some text</div> 
<div class="clear"></div> 
<div style="float:left">some text</div> 
<div style="float:left">some text</div> 

感谢

+0

这是[Doctype](http://doctype.com/)的问题。 – kiamlaluno 2010-08-04 18:56:13

+0

IE7在处理清晰方面似乎有一个“bug”:两者都有。它不适用于例如标签标签,如果您将其设置为显示:block并且清除:对于这些标签也是如此。 – Johncl 2013-12-20 09:52:14

回答

1

尝试添加一些内容到div

<div class="clear">&nbsp;</div> 

一个更好的方式来做到这一点,虽然,是clearfix

+0

嗨 对不起,但它不工作

 
Mayur 2010-06-03 11:08:00

+0

@Mayur奇怪!然后我不知道它会是什么,对不起。你确定CSS正在被加载吗? – 2010-06-03 11:09:13

+0

佩卡对不起,现在我已经尝试了一个clearfix属性它的工作非常感谢...... – Mayur 2010-06-03 11:15:12

0

在没有内容的父div中添加一个div,并使用style.For清除它。

+1

你应该给一个例子来澄清你的答案。 – Magnilex 2014-01-18 08:18:56