Internet explorer IE 8.0中忽略的div宽度

Internet explorer IE 8.0中忽略的div宽度,internet-explorer,styles,Internet Explorer,Styles,我的文件类型是: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 我在页面上有一个div,如下所示: <div style="width:400px;"> <p>Some content and some more content etc.</p> </div> <div st

我的文件类型是:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

我在页面上有一个div,如下所示:

<div style="width:400px;">
<p>Some content and some more content etc.</p>
</div>
<div style="width: 400px !important;">
<p>Some content and some more content etc.</p>
</div>

一些内容和更多内容等

在IE 8.0中查看时,div宽度被忽略,div不仅占据整个屏幕,而且如果段落标记之间的文本足够长,则会从屏幕右侧消失


那么,IE 8.0完全忽略了为div设置的宽度?你如何克服这个问题呢?我不确定IE8的问题是否是其他(通用的)CSS正在覆盖你的CSS,但是如果是这样,你可以尝试添加重要的!修改器如下:

<div style="width:400px;">
<p>Some content and some more content etc.</p>
</div>
<div style="width: 400px !important;">
<p>Some content and some more content etc.</p>
</div>

问题也可能出在
标记上,而不是div上,因此请尝试使用IE开发工具来跟踪哪个元素实际具有不必要的大宽度。

您应该转义代码,以便我们可以看到它!