Aravind30790
Aravind30790

Reputation: 992

How to make a all the three tables to display at same height

I have three tables table1,table2,table3 all wrapped inside a table, while adding different size of contents to the tables each expands to different height , how to make all the three tables display at same height even after adding different size of content

HTML :

<div class="csdiv">
<table cellpadding="2" cellspacing="0">
    <tr valign="top">
        <td>
            <table class="cstable" width="100%" height="265">
                    <tr height="35">
                        <th width="33%" nowrap>Table1</th>
                    </tr>
                    <tr>
                        <td valign="top" bgcolor="FFFFFF" width="275">


                        </td>
                    </tr>
            </table>
        </td>
        <td>
            <table class="cstable" width="100%" height="265">
                    <tr height="35">
                        <th nowrap width="34%" nowrap>Table2</th>
                    </tr>
                    <tr>
                        <td valign="top" bgcolor="FFFFFF" width="275">

                        </td>
                    </tr>
            </table>
        </td>
        <td>
            <table class="cstable" width="100%" height="265">
                    <tr height="35">
                        <th nowrap width="33%" nowrap>Table3</th>
                    </tr>
                    <tr>
                        <td valign="top" bgcolor="FFFFFF" width="275">


                        </td>
                    </tr>
            </table>
        </td>                                  
    </tr>
</table>
</div>

CSS:

.csdiv {
    font-family: 'Trebuchet MS',Tahoma,Arial,sans-serif;
    font-size: 12px;
    line-height: 1em;
}
.cstable {
    border-collapse: collapse;
    border-color: #666666;
    border-style: solid;
    border-width: 1px;
    font-family: 'Trebuchet MS',Tahoma,Arial,sans-serif;
    font-size: 12px;
    line-height: 1em;
}
.cstable th {
    background-color: #A3C2FF;
    border-collapse: collapse;
    border-color: #666666;
    border-style: solid;
    border-width: 1px;
    color: #000000;
    font-family: 'Trebuchet MS',Tahoma,Arial,sans-serif;
    font-size: 12px;
    font-weight: bold;
    line-height: 1em;
    text-align: left;
}

JSFIDDLE : DEMO

Upvotes: 1

Views: 809

Answers (1)

NoobEditor
NoobEditor

Reputation: 15871

Your parent elements has no height set, so the table is taking height only equal to the content.To make it full height, add

 html,body{
    height:100%; /*give full height to document */
    width:100%;
    margin:0;
    padding:0;
 }
 table{
    height:100%; /* stretch table to parents height*/
 }

demo

Upvotes: 6

Related Questions