Marquinio
Marquinio

Reputation: 4831

100% height issue with IE8 doctype declaration

Ok I have a simple HTML web page. Problem is that when I specify a Doctype at the beginning of the page, my stylesheet height:100% does not work.

If I remove the doctype declaration everything works as expected. So anyone knows why this happens? What doctype should I use?
I also tried using "Strict" DOCTYPE declaration but still same problem. Thanks in advance.

Below is the full HTML where height:100% does not work:

<!DOCTYPE html PUBLIC "-//VYOM//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org    /TR/xhtml1/DTD/transitional.dtd">
<html>     
<body>
    <div style="background-color:red; height:100%;">
        testing 123...
    </div>     
</body>

If I remove the doctype the DIV occupies 100% of the available height as expected:

<html>     
<body>
    <div style="background-color:red; height:100%;">
        testing 123...
    </div>     
</body>
</html>

Upvotes: 0

Views: 1175

Answers (1)

Diodeus - James MacFarlane
Diodeus - James MacFarlane

Reputation: 114447

Add:

body, html {
    height:100%
}

Upvotes: 3

Related Questions