what is the basic way to render a fixed layout table that will be consistent in every browser (ie 6-8, FF, chrome)

i am using:

#myTable
{
   table-layout:fixed;
}

my first column is width=200px and all other columns are width=30px

it seems if i specify each column width with no table width i get the best results in FF, Chrome and IE8, but ie7 seems to ignore the column widths in this case. (all columns in ie7 seems to be about the same width)

if i add an explicit table width, now FF seems to ignore the column specific widths . .

any suggestions?

  • Dumb question, I know, but do the column widths add up to the total table width? Doug almost 7 years ago
  • Care to show a snippet of your codes? BTW, IE7 is a pain in the .... oh and IE6 too. We'll still have to live with them. o.k.w almost 7 years ago
  • column widths do add up to total table width Adam K. almost 7 years ago

1 answer

o.k.w 2355
0
points

I have no issue with the table using what you have described. This is the code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style type="text/css">
#myTable
{
   table-layout:fixed;
}
</style>
</head>
<body>
<table id="myTable" border="1" cellspacing="0" cellpadding="0" style="width: 290px;">
<tr>
    <td style="width:200px">1</td>
    <td style="width:30px">2</td>
    <td style="width:30px">3</td>
    <td style="width:30px">4</td>
</tr>
</table>
</body>
</html>

I get consistent output in IE8 and FF and I think IE7 too. Is there something I missed out?

Answered almost 7 years ago by o.k.w
  • i am using : <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> does that matter ? Adam K. almost 7 years ago
  • Not really, at least not for the rendering of the table. Are you able to use the my code and see if it works for you (using your XHTML doctype)? o.k.w almost 7 years ago