tags:

views:

205

answers:

4

hi friends,

Can someone tell me how I can make a table be 100% height in Mozilla browsers?

this is the html code

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>
<body>
<table cellpadding="0" cellspacing="0" width="177"  height ="100%">
    <tr>
     <td height="100%">&nbsp;</td>
    </tr>
</table>

</body>

</html>
+1  A: 

Maybe this can give you a hint?

<head>
    <style type="text/css">
    html, body{
        margin:0;
        padding:0;
        height:100%;
        border:none;
    }
    table {
        height: 100%;
        background: red;
    }
    </style>
</head>
<body>
    <table>
        <tr>
            <td>Hello</td>
        </tr>
    </table>
</body>
Mickel
I have one problem, In my html page there is many tables, i wand to adopt this 100% only in one table. how i call this css like a function?
Alex
You apply a class instead. <table class="myclass"> and change "table" in the CSS to ".myclass".
Mickel
A: 

As the above answer shows, you use CSS to do this.

Setting the html, body height to 100% so that the contents can use its parents height:

html, body { height: 100%; }

And then setting your tables height to 100%:

table { height: 100%; }

This should result in the desired effect.

HenryRat
A: 

You can't: 10.5 Content height: the 'height' property

Yes, you can. The percentage is inherited by the parent container, so if all previous containers (including html and body) is set to 100%, then you can set the height of a child container to 100% and the effects will be enjoyable ;)
Mickel
+1  A: 

Sounds like you're laying your page out in a table, which you really shouldn't be doing. It's better to mark up your page properly rather than laying everything out in tables.

Evernoob