【问题标题】:min-width is not working in IE for frozen layoutmin-width 在 IE 中不适用于冻结布局
【发布时间】:2012-02-19 12:18:02
【问题描述】:

我想在网站模板中制作冻结布局,但在 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 中不起作用!大家有什么建议

【问题讨论】:

  • 冻结是什么意思?哪个版本的 IE 有这个问题?
  • 我的意思是当调整凉亭的大小时,布局仍然是冻结的,一些布局会隐藏,其他的会稳定。
  • 同stackoverflow布局,尝试重新调整浏览器大小。
  • 我认为它被称为“固定宽度布局”。在 IE9 中似乎没有问题。你用的是什么IE版本? - jsfiddle.net/LKaT8/1

标签: html css internet-explorer layout cross-browser


【解决方案1】:

您必须定义&lt;p&gt; 元素的min-width 属性。

例子:

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

【讨论】:

  • 为什么会这样? p 元素也不会从已经具有 min-width: 1300px 的 div 元素继承宽度?
【解决方案2】:

将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">

【讨论】:

    【解决方案3】:
    猜你喜欢
    • 2016-06-18
    • 1970-01-01
    • 2013-06-01
    • 1970-01-01
    • 2016-02-05
    • 2016-05-22
    • 1970-01-01
    • 2011-01-03
    • 1970-01-01
    相关资源
    最近更新 更多