“Height=100%” is not working in html when using ?

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>

Leave a Comment