Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CSS min-height not working on mozilla firefox

Tags:

css


I created a div tag with min-height and gave background color 'red'. but on mozilla firefox the height of the div not increasing when the content crosses min-height limit. heres my code:

<style type="text/css"><!--
ul {
    display:block;
    padding:0px;
    width:500px;
}

.b {
    width:250px;
    float:left;
    display:block;
}

div {
    min-height:50px;
    width:500px;
    background-color:red;
}
--></style>

<div>
    <ul>
        <li class="b">asdsad</li>
        <li class="b">asdsad</li>
        <li class="b">asdsad</li>
        <li class="b">asdsad</li>
        <li class="b">asdsad</li>
        <li class="b">asdsad</li>
        <li class="b">asdsad</li>
    </ul>
</div>

its seeming the div height would have to be set to fit contents,but I don't know how else can I do that.if I don't use height then background-color can't be set.please tell me how can I fit the contents to the div as well as the background color would be red.
(Don't know if I explained it clearly.so please ask me if you want to know more about the question.)

-Thanks.

RESOLVED: thank you everybody for your kind answers.

like image 833
user1844626 Avatar asked Dec 27 '12 10:12

user1844626


People also ask

How do you set the minimum height in CSS?

CSS Demo: min-height This is a box where you can change the minimum height. If there is more content than the minimum the box will grow to the height needed by the content. The element's height is set to the value of min-height whenever min-height is larger than max-height or height .

How do you give max and min height in CSS?

The min-height property in CSS is used to set the minimum height of a specified element. The min-height property always overrides both height and max-height . Authors may use any of the length values as long as they are a positive value.

What is min height Auto?

The min-height property defines the minimum height of an element. If the content is smaller than the minimum height, the minimum height will be applied.

What is the difference between min height and height?

The difference between height and min-height is that height defines a value for the height and that's how tall the element will be. min-height says that the minimum height is some value but that the element can continue to grow past that defined height if needed (like the content inside makes it taller or whatever).


1 Answers

On Firefox, min-height is not interpreted on display: table(-*); properties, juste try to use height: 50px; instead as it is interpreted as minimum height on tables.

Source

like image 199
Clément Fiorio Avatar answered Oct 04 '22 20:10

Clément Fiorio