0

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>
Matt
  • 74,352
  • 26
  • 153
  • 180
Marquinio
  • 4,601
  • 13
  • 45
  • 68

1 Answers1

3

Add:

body, html {
    height:100%
}
Diodeus - James MacFarlane
  • 112,730
  • 33
  • 157
  • 176