htmlcssheighthtml4

Can't define HTML table height


I'm working on a school project, where we have to design a website with html 4.01 and must not use CSS at all. My Question is, how can I expand a table over the whole window height? I have tried the height attribute with a percantage value, but it didn't work. I couldn't find any good solutions for my problem since all of them used inline CSS or the style tag. here is my code:

<!DOCTYPE HTML>
<html lang="en-GB">
    <head>
        <title>Horse Audio</title>
    </head>
    <body>
        <table cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#f8f8f8">
            <tbody><tr bgcolor="#d1bc8a">
                <td width="4%">
                    <center><img src="images/Logo.png" alt="Logo" width="45" height="45" align="middle"></center>
                </td>
                <td>
                    <font color="#3d5385" size="56px" face="DejaVu Serif Bold"><b>HORSE AUDIO</b></font>
                </td>
                <td width="5px" bgcolor="#a99972"></td>
                <td width="10%">
                    <center>Contact</center>
                </td>
                <td width="5px" bgcolor="#a99972"></td>
                <td width="10%">
                    <center>Product</center>
                </td>
                <td width="5px" bgcolor="#a99972"></td>
                <td width="10%">
                    <center>FAQ</center>
                </td>
                <td width="5px" bgcolor="#a99972"></td>
                <td width="25%">
                    <center>Search</center>
                </td>
            </tr>
            <tr>
                <td colspan="5">
                    <center>Test</center>
                </td>
            </tr>
            <tr>
                <td colspan="5" bgcolor="#322c1d">
                    Test
                </td>
            </tr>
            </tbody></table>
    </body>
</html>


Solution

  • If you specify the version as HTML5 and try to set height="...", it won't work. Since in HTML5 there isn't a height-attribute for table, it will be ignored. Without CSS, the best you can do is:

    Try deleting: <!DOCTYPE html>

    and then add: height="100%" to <table>.

    <html lang="en-GB">
        <head>
            <title>Horse Audio</title>
        </head>
        <body>
            <table height="100%" cellpadding="0" cellspacing="0" border="0" width="100%" bgcolor="#f8f8f8">
                <tbody><tr bgcolor="#d1bc8a">
                    <td width="4%">
                        <center><img src="images/Logo.png" alt="Logo" width="45" height="45" align="middle"></center>
                    </td>
                    <td>
                        <font color="#3d5385" size="56px" face="DejaVu Serif Bold"><b>HORSE AUDIO</b></font>
                    </td>
                    <td width="5px" bgcolor="#a99972"></td>
                    <td width="10%">
                        <center>Contact</center>
                    </td>
                    <td width="5px" bgcolor="#a99972"></td>
                    <td width="10%">
                        <center>Product</center>
                    </td>
                    <td width="5px" bgcolor="#a99972"></td>
                    <td width="10%">
                        <center>FAQ</center>
                    </td>
                    <td width="5px" bgcolor="#a99972"></td>
                    <td width="25%">
                        <center>Search</center>
                    </td>
                </tr>
                <tr>
                    <td colspan="5">
                        <center>Test</center>
                    </td>
                </tr>
                <tr>
                    <td colspan="5" bgcolor="#322c1d">
                        Test
                    </td>
                </tr>
                </tbody></table>
        </body>
    </html>

    When I run it on Firefox or Chrome, it works just fine.