min-height:自动在Opera中不起作用

时间:2012-10-25 14:07:58

标签: css opera

我注意到min-height在Opera中不起作用。我正在尝试这样的事情:

<div class="content"><div>
<div class="content newstyle"><div>

我的CSS代码是:

.content {
    min-height: 600px;
}
.newstyle {
    min-height: auto;
}

歌剧就像min-height那样不存在 如果我在.newstyle中应用任何其他样式,如背景或其他任何样式,那么它运作良好。但是min-height: auto似乎不起作用......

有什么想法吗?

2 个答案:

答案 0 :(得分:13)

CSS2.1 defines the initial value of min-height to be 0, not auto. CSS2.1中从未存在值auto,因此在CSS2.1中无效。只需使用min-height: 0代替:

.content {
    min-height: 600px;
}
.newstyle {
    min-height: 0;
}

答案 1 :(得分:5)

auto;不是value属性的有效min-height,因此Opera忽略......

您可以使用min-heightpx等,或cm%

指定inherit

Sitepoint Reference