"Height=100%" is not working in html when using <!DOCTYPE>?

Solution 1:

Adding a DOCTYPE switches you from quirks mode to standards mode. In standards mode, the html and body elements do not default to 100% of the size of the viewport (browser window); instead, they are only as large as they need to be to contain their children. The table height of 100% means 100% of the containing element, but that's only as large as it needs to be to contain the contents of the table. Quirks mode is an emulation of the behavior of older browsers, in which the html and body elements filled the viewport.

To fix the problem, you just need to add this to your document:

<style>
  html, body { height: 100% }
</style>

Solution 2:

When you state 'height=100%' you have to think "100% of what?". It's the parent of that table element which is the body. But how tall is the body?

To do what you want, add this in the CSS: html,body{height:100%}