I have a table row that contains 3 td
s. In the middle td
there is text, so it has a certain height, e.g. 100px.
The two td
s on the left and the right contain a table each that display a (later) clickable area which is supposed to have the same height as the middle td
- so 100px in my example.
Unfortunately, only Firefox stretches the left and right td
s to 100% height. Chrome, Safari and IE just put it on minium height.
Here's the fiddle: http://jsfiddle.net/X3YAu/
I've played around with the display
property but it didn't help. Doesn't the 100% height refer to the parent element and if so why don't the td
s strech to the 100% height of the parent element?
The height of rows 'tr' in a table can be fixed very easily. This can be done by adding the height attribute in the tr tag. If the height is not specified, the height of the row changes according to the content. The height can be specified either in pixels, or percentage.
The usual trick is to put (which is a so-called escape sequence, or formally entity reference, for a character called no-break space) into a table cell.
var trTagHeight = tableHeight/totalRowInTable; console. log(trTagHeight); //Note: This is approx value of each row, excluding padding and cell padding value. This is probably the closest answer so far. The only thing is that it won't guarantee any particular row... just the average height of all of them.
Putting the
in your empty <td></td>
should help.
I rewrote entirely your code because you have a lot of useless tags there, this should work:
<table align="center" width="100%" cellpadding="0" cellspacing="0">
<tr>
<td align="center" width="100%" height="20" colspan="3" bgcolor="#A9DBF5">
<img src="http://cdn2.iconfinder.com/data/icons/splashyIcons/arrow_large_up.png" width="16" height="16" title="Up" alt="Arrow up" style="display:inline-block;" />
</td>
</tr>
<tr>
<td align="center" width="22" height="100">
<img src="http://cdn2.iconfinder.com/data/icons/splashyIcons/arrow_large_left.png" width="16" height="16" title="Left" alt="Arrow left" style="display:inline-block;padding:3px;background:#A9DBF5;" />
</td>
<td align="left" height="100" bgcolor="#FFFFFF">
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.
</td>
<td align="center" width="22" height="100">
<img src="http://cdn2.iconfinder.com/data/icons/splashyIcons/arrow_large_right.png" width="16" height="16" title="Right" alt="Arrow right" style="display:inline-block;padding:3px;background:#A9DBF5;" />
</td>
</tr>
<tr>
<td align="center" width="100%" height="20" colspan="3" bgcolor="#A9DBF5">
<img src="http://cdn2.iconfinder.com/data/icons/splashyIcons/arrow_large_down.png" width="16" height="16" title="Down" alt="Arrow down" style="display:inline-block;" />
</td>
</tr>
</table>
As you see, instead of using empty <td>
s , i just put one there with argument colspan="3"
spread one td entirely on three columns.
Here is a demo: jsbin LINK
Note that, i didn't used border-radius
and border
css as you did, to maintain the code as short as possible, so you can get the idea.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With