min-height: auto not working in Opera
Asked Answered
E

2

8

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?

Electrify answered 25/10, 2012 at 14:7 Comment(0)
A
14

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;
}
Amidships answered 25/10, 2012 at 14:17 Comment(3)
It has since been removed from the Flexbox module and that TR link anchor, #min-size-auto is no longer valid.Gylys
@danorton: Thanks, I've removed the flexbox reference entirely.Amidships
For those searching, same thing will occur in Safari. The slightly annoying thing is if you're developing in eg. Chrome, you won't notice because Chrome permissably allows you to still use auto. :)Legionnaire
T
6

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

Teliospore answered 25/10, 2012 at 14:9 Comment(9)
And what if i just dont want to establish a min-height but i want to ignore the other style min-height?Electrify
@Amidships nah I don't think auto is validTeliospore
@Steve didn't got you and btw you don't need to use min-height: auto; as your div height is is auto by default unless and until you give the div some heightTeliospore
min-height:0 It's ok. Stupid of me :) Thanks!Electrify
@Amidships whats the use of min-height: 0? cuz browser default height of div's is set to autoTeliospore
@Mr. Alien: He wants to reset min-height to the default value, and that value is 0. Remember that we're talking about min-height, not height - they're two different things.Amidships
@Amidships ya right, but what happens if am setting min-height to 0? anyways it's height will be 0 even if I don't specifyTeliospore
In the HTML, the .content class is on both divs, and he wants to reset it for .newstyle.Amidships
@Amidships ya this is great when you want to RESETTeliospore

© 2022 - 2024 — McMap. All rights reserved.