Forum Moderators: open

Message Too Old, No Replies

Table cell height discrepancy between browsers

         

XxLaSeRxX

10:22 pm on Sep 10, 2008 (gmt 0)

10+ Year Member



I have a simple table like this in my page:


<table border='1' width="100%">
<tr>
<td width="15%" height="5px" valign="bottom" style="text-align:right;"><font size="4px" color="black">Name: </font></td>
<td width="15%" height="5px" style="text-align:left;">1</td>
<td width="70%" height="100%" style="text-align:center;" rowspan="4"><embed video here></embed> </td>
</tr>
<tr>
<td height="5px" valign="bottom" style="text-align:right;"><font size="4px" color="black">Location: </font></td>
<td height="5px" style="text-align:left;">Town</td>
</tr>
<tr>
<td height="5px" valign="bottom" style="text-align:right;"><font size="4px" color="black">Price: </font></td>
<td height="5px" style="text-align:left;"> $55.00</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

Now, in FF it shows the 3 fields Name, Location, and Price all right under each other like this:

Name:1
Location:Town
Price:$55.00

But in IE the fields are spread out evenly within the table:

Name:1

Location:Town

Price:$55.00

Next to the fields I have a video which is in a cell with rowspan of 4. I have a blank field under price so that it may expand as the video size gets bigger. I want it too look the way it does in FF, all right under each other. Im not sure what could be the problem. Does anyone know?

piskie

12:19 am on Sep 11, 2008 (gmt 0)

10+ Year Member



Try validating the code and I think all will be revealed. For example this is not valid code:
<td height="5px"

Try previewing your code in FF with Html Tidy code validator installed. It will show non compliance and take into account your DTD.

XxLaSeRxX

4:05 am on Sep 11, 2008 (gmt 0)

10+ Year Member



Ive validated the code and Ive fixed all the "px" and the DOCTYPE. Its still showing up the same way. Nothing changed.


<table border='1' width="100%">
<tr>
<td width="15%" height="5" valign="bottom" style="text-align:right;"><font size="4" color="black">Name: </font></td>
<td width="15%" height="5" style="text-align:left;">1</td>
<td width="70%" height="100%" style="text-align:center;" rowspan="4"><embed></embed></td>
</tr>
<tr>
<td height="5" valign="bottom" style="text-align:right;"><font size="4" color="black">Location: </font></td>
<td height="5" style="text-align:left;">Town</td>
</tr>
<tr>
<td height="5" valign="bottom" style="text-align:right;"><font size="4" color="black">Price: </font></td>
<td height="5" style="text-align:left;">$55.00</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

tedster

5:44 am on Sep 11, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Yes, that is one of the IE quirks - but I couldn't see it at first using just your source code until I replaced the <embed><embed> element with an image of some size. Then the spread out that IE creates becomes clear.

One way to get IE to do what you need is to nest a second table in the first column to hold your text data, and make that column "vertical-align:top".

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
<title>Table Cell Test</title>
</head>
<body>
<table border=1 width="100%">
<tr>
<td style="vertical-align:top;">

<!--nested table begins-->
<table border=1>
<tr>
<td width="15%" style="text-align:right;">Name:</td>
<td width="15%" style="text-align:left;">1</td>
</tr>
<tr>
<td style="text-align:right;">Location:</td>
<td style="text-align:left;">Town</td>
</tr>
<tr>
<td style="text-align:right;">Price:</td>
<td style="text-align:left;">$55.00</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<!--nested table ends-->

</td>
<td style="text-align:center;"><img src="s.gif" width="400" height="400"></td></tr>
</table>
</body>
</html>