CSS Work in Chrome but not Firefox (div height)

I am building a website and mostly testing it in Chrome. I recently realized that some CSS is not applied in Firefox.

I assume this is possible: main {min-height}

This jFiddle reproduces this error where the main div does not have the height it should have. http://jsfiddle.net/msW9m/

HTML:

<div id='main'></div>
<div id="container"></div>
<div id='footer'>
    <div id='footerRelative'>Development by <a href='mailto:'>John Doe</a></div>
</div>

CSS:

#main {
    min-height: 80%;
    height: auto;
    border: 1px solid #bbbbbb;
    margin: 3% 5% 1%;
    padding: 10px 10px;
}
#footer {
    position: absolute;
    left: 50%;
}
#footerRelative {
    position: relative;
    left: -50%;
    font-size: 80%;
}
/*Probably Irrelevant*/
#container {
    margin: 0 auto;
    margin-top: -300px;
    margin-left: -261px;
    position: absolute;
    top: 50%;
    left: 50%;
    width: 523px;
    height: 600px;
    background-image: url('../images/doctorSymbol.jpg');
    background-repeat:no-repeat;
    background-position:center;
    opacity: 0.125;
    overflow: hidden;
    z-index: -1;
}

However, everything works fine in Chrome, and the main div has a minimum height of 80%. I was wondering if there is a workaround for this or if I am doing something wrong.

Thank.

+5
source share
3 answers

Have you tried making body and html 100%?
In some browsers, the body element does not maintain a height of 100% until its contents are filled.

http://jsfiddle.net/HRKRN/

html, body {
    height: 100%;
}
+7

: div table-cell.

+2

CSS3

http://pastebin.com/Q8727Kvt

CSS 3

0
source

All Articles