min-height: auto not working in Opera

岁酱吖の 提交于 2019-12-08 17:00:22

问题


I have noticed that min-height is not working in Opera. I am trying something like this:

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

And my CSS code is:

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

And Opera just acts like min-height didn't exist.
If I apply any other style in .newstyle, like background or whatever, then it works well. But min-height: auto seems not to work...

Any idea?


回答1:


CSS2.1 defines the initial value of min-height to be 0, not auto. The value auto never existed in CSS2.1, so it is invalid in CSS2.1. Just use min-height: 0 instead:

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



回答2:


auto; is not a valid value for min-height property and hence Opera ignores...

You can specify min-height using px, cm etc, or % or inherit

Sitepoint Reference



来源:https://stackoverflow.com/questions/13070456/min-height-auto-not-working-in-opera

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!