Link to home
Start Free TrialLog in
Avatar of EffinGood
EffinGoodFlag for United States of America

asked on

<td> height issue

Hi experts,

I've searched all over for an answer to this question, but all the answers appear to have been written several years ago and reference IE 6, and I'm hoping a better solution has been found since then. For my purposes, I only need to be compatible with IE 8 and up.

In the table below, Cells 1, 2, 3, 5, 6 and 7 are all set to specified heights; cell 4 is intended to expand as needed so that the table as a whole fills the entire page height. This table displays correctly in Firefox and Chrome, but in IE, cell 3 extends far beyond its specified height of 30px. How do I fix this?

Thanks!

<style type="text/css">
table {
	border-width: 2px;
	border-spacing: 0px;
	border-style: solid;
	border-color: black;
	border-collapse: separate;
	background-color: white;
}
 td {
	border-width: 2px;
	padding: 1px;
	border-style: solid;
	border-color: black;
	background-color: white;
	text-align:center;
}
</style>

<table cellpadding="3" cellspacing="3" style="table-layout:fixed; width: 100%; height: 100%;" ID="Table3">
    <tr>
        <td colspan="2" style="height: 30px;">Cell 1</td>
    </tr>
    <tr>
        <td rowspan="2" style="height: 305px;">
            Cell 2
        </td>
        <td style="height: 30px;">
            Cell 3
        </td>
    </tr>
    <tr>
        <td rowspan="2">
           Cell 4
        </td>
    </tr>
    <tr>
        <td style="height: 105px;">
            Cell 5
        </td>
    </tr>
    <tr style="height: 50px;">
        <td>
           Cell 6
        </td>
        <td>
            Cell 7
        </td>
    </tr>
</table>

Open in new window

Avatar of ramyajanarthanan
ramyajanarthanan
Flag of India image

Try hacking like this

<td style="height: 30px;height:0px\9;">
            Cell 3
        </td>
Avatar of Eddie Shipman
I believe if you set your line-height, it should fix the problem.
I don't understand what you are trying to do, but if you are trying to use a table to do layout it might explain why you only find IE6 references.  Tables for layout are a 20th century technique, and no amount of hacking is going to them as stable and manageable as modern layouts using modern markup and CSS.

Tables are for presenting tabular data.  Using them for anything else guarantees all kinds of problems.

Cd&
ASKER CERTIFIED SOLUTION
Avatar of Member_2_248744
Member_2_248744
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
If I take out the 'style' statements in the "td"s, your table looks the same in IE and Firefox.  That means that your 'rowspan' attributes are not making sense.
Avatar of EffinGood

ASKER

None of the answers fully resolved my question, but this one came closest.