最小宽度在冻结布局的IE中不起作用



我想在网站模板中进行冻结布局,但我在Internet Explorer中遇到了问题。

我做这个

<div id="NewsBlock">
    <div id="aboutUs">
        <h1></h1>
        <span class="OpenDayBanner"></span>
        <p>You can replace the paragraph above with some text describing your FAQ system. Here's an example: If you have questions about our web site, our products or our services, there’s a good chance you’ll find the answer here</p>
    </div>
</div>

对于CSS,我做了这样的

div#NewsBlock{
    min-width: 1300px;   //this work for Firefox and chrome
    width:100%;
    overflow: hidden;
    height: 510px;
    background-image:url(../images/aboutstartupbg.png);
    background-repeat: repeat-x;
 }

使用最小宽度和宽度百分比值可以在Firefox和Chrome中冻结布局,但在IE中不起作用!!任何建议请

您必须定义<p>元素的最小宽度属性。

示例:

p.myClass {
    min-width: 420px;
   }

通过将HTML的dtd更改为XHTML 来解决问题

 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" ">  

   <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org    /TR/xhtml1/DTD/xhtml1-transitional.dtd">
   <html xmlns="http://www.w3.org/1999/xhtml">

使用严格的doctype,如<!DOCTYPE HTML>,以确保IE的rending正确。

还可以考虑将<meta http-equiv="X-UA-Compatible" content="IE=edge" />添加到<head>中。

最新更新