Amr Elnashar
Amr Elnashar

Reputation: 1769

height: auto; doesn't work with firefox

I have Div Container with css class:

    .content4
   {
    height: 1400px;
    width: 920px;
    border: 1px solid #CCCCCC;
    background-color: #FFFFFF;
    padding-bottom: 25px;
    padding-top: 25px;
    background-image: url(../images2/bg.gif);
   }

and i need to make it auto height for its content

its working properly in IE but doesn't work in firefox.

any help please?

Upvotes: 1

Views: 6637

Answers (2)

Axel Gneiting
Axel Gneiting

Reputation: 5403

Use something like that:

.test
{
     min-height: 300px;
     height: auto !important;  /* for other browsers */
     height: 300px;  /* for IE */
}

Upvotes: 4

alex.zherdev
alex.zherdev

Reputation: 24164

If I understood the case correctly, your style is working like it should (in FF, of course :)) If you specify the particular height, the div should not change its height when its content wants more. What you observe in IE is that it's actually treating a "height" as a "min-height". The solution here is to specify min-height for browsers, and height for IE :)

Upvotes: 1

Related Questions