Sebastian
Sebastian

Reputation: 573

I want to set a table to full height and width

Okay so I want to set the table to full height and width I mean I want it to be full screen and I really don't know what is wrong. The width it's okay, it is to full size but something is wrong with the height.

    <!DOCTYPE html>
<html>
    <head>
        <link type="text/css" rel="stylesheet" href="stylesheet.css"/>
        <title>Beta design</title>
        <style type="text/css">
        .tg  {border-collapse:collapse;border-spacing:0;}
        .tg td{font-family:Arial, sans-serif;font-size:14px;padding:10px 5px;border-style:solid;border-width:1px;overflow:hidden;word-break:normal;}
        </style>
    </head>
    <body>

        <div id="login">
            <img src="login.png" alt="Login"s>
        </div>

        <table class="tg">
            <tr>
                <td class="tg-031e"></td>
                <td class="tg-031e"></td>
                <td class="tg-031e"><td>
            </tr>
            <tr>
                <td class="tg-031e"></td>
                <td class="tg-031e"></td>
                <td class="tg-031e"></td>
            </tr>
            <tr>
                <td class="tg-031e"></td>
                <td class="tg-031e"></td>
                <td class="tg-031e"></td>
            </tr>
        </table>

    </body>
</html>

and the css:

    body {
  background-image: url("wallpaper 2 final.png")
}
#login {
     position: fixed;
     top: 50%;
     left: 50%;
     height: 400px;
     width: 360px;
     margin-top: -200px;
     margin-left: -180px;
}
.tg {
     height: 100%;
     width: 100%;
}

Upvotes: 1

Views: 66

Answers (1)

Praveen Kumar Purushothaman
Praveen Kumar Purushothaman

Reputation: 167212

Give this to the top of the CSS:

html, body {width: 100%; height: 100%;}

Upvotes: 2

Related Questions