【问题标题】:How to set the minimum height of a <div> box in Internet Explorer 8?如何在 Internet Explorer 8 中设置 <div> 框的最小高度?
【发布时间】:2013-05-30 10:21:47
【问题描述】:

以下 CSS 代码使用应用于 &lt;div&gt; 框的 min-height 属性在 Internet Explorer 8 中无法正常工作。下面给出了一个示例。

 .myDiv
{
    min-height:200px;
    height:auto !important;
    height:200px;

}

我如何设置&lt;div&gt; 框的最小高度以在 Internet Explorer 8 中工作?

【问题讨论】:

标签: css internet-explorer internet-explorer-8


【解决方案1】:

您的代码应该可以正常工作,因为它支持像min-height 这样受到威胁。

您可以尝试将以下属性添加到您的样式中

<!--[if IE]>
<style type="text/css">
    .myDiv { 
      height:expression(this.scrollHeight < 200 ? "200px" : "auto");
    }
</style>
<![endif]-->

如果它仍然不起作用,那么您可能在其他元素和/或正确嵌套您的 .myDiv 时遇到了一些问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-13
    • 2011-06-12
    相关资源
    最近更新 更多