0

I wrote a HTML file to create a table that occupies 80% of the width and height of the browser window. Here is the code without <!DOCTYPE html> that produces the correct output:

<html>
<head>
    <style>
        table, td {border:1px solid black; width:80%; height:80%}
        td {width:33.33%; height:33.33%}
    </style>
</head>
<body>
    <table>
        <tr><td></td><td></td><td></td></tr>
        <tr><td></td><td></td><td></td></tr>
        <tr><td></td><td></td><td></td></tr>
    </table>
</body>
</html>

But when I add <!DOCTYPE html>at the top, I don't get the correct output; only the width of the table occupies 80% of the width of the browser window.The height of the table uses the minimum amount of space needed.

I have tried this in Chrome and Edge browsers. I am using VS Code as my editor.

Edit: If I give height a value in px, then it works correctly.

Shabbir Khan
  • 187
  • 1
  • 8

0 Answers0