Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Tables the same height

Status
Not open for further replies.

jonbatts

Programmer
Apr 12, 2005
114
US
OK, I've yet to find a definitive answer as to why [tt]style="height:100%"[/tt] doesn't work on a table inside a cell to fill the height of the entire cell. In fact, everything I read seems to tell me it should. I'm trying to get Table1 and Table2 to be the same height. So here's my code:
Code:
<table style="width:100%">
    <tr>
        <td colspan="2">Testing</td>
    </tr>
    <tr>
        <td style="width:200px">
            <table id="Table1" style="border-right: green 5px solid; border-top: green 5px solid; border-left: green 5px solid; border-bottom: green 5px solid; height:100%; width:100%">
                <tr>
                    <td>1</td>
                    <td>2</td>
                </tr>  
            </table>
        </td>
        <td>
            <table id="Table2" style="border-right: red 5px solid; border-top: red 5px solid; border-left: red 5px solid; border-bottom: red 5px solid; height:100%; width:100%">
                <tr>
                    <td>3</td>
                    <td>4</td>
                </tr> 
                <tr>
                    <td>5</td>
                    <td>6</td>
                </tr>
            </table>
        </td>
    </tr>
</table>
I'm using IE6, and for all practical purposes could care less about other browsers. If someone has an answer or could point me to it, I would appreciate it.
 
I created it in VS2003, so here's what it put in for me.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] >
    <head>
        <title>Untitled Page</title>
    </head>
    <body>
...
    </body>
</html>
 
The tables are stretching with the content.
You could always put the borders round the 2 parent table cells rather than the child tables.
Also, top align the cells to make it pretty.

Keith
 
I just realized what i need to do. The reason I can't just move the borders to the cell instead of the table is because I'm not actually worried about colored borders on my page, I simply put them there so looking at the page would show me my page wasn't doing what I thought it should. My reasoning behind wanting them the same height is because I'm actually dealing with images as borders.
Like I said, I figured out how to do it, but I can't believe I didn't think of it before. Right now my outer table has 2 rows, all I need to do is add a third row, and put my bottom borders in there.
Obviously very simple, and solves my problem, but it would still be nice to know why my original code wasn't doing what I thought. Still open to any ideas, which may help someone in the future. Thanks audiopro; even though your answer wasn't the one I was looking for it got me thinking in the right direction.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top