Click to See Complete Forum and Search --> : defiant table cells ignoring width specifications


sneakyimp
08-07-2008, 08:56 PM
OK I am trying to display a table with *exact* width specs for each column. I have my doctype as strict, i have a style applied to each cell that specifies a width, and yet the widths of the columns vary because the browser seems to be auto-adjusting the layout. At least all this is true when I view it in firefox. You can see it here:
http://jaith.net/questions/table.htm

The first column should be 50px in width. The next 15 or so columns should all be 75px in width but as you can see (when using firefox 2) they vary. WTF?

I have tried setting various CSS properties such as white-space:nowrap and table-layout: fixed and so on but it doesn't help. Any tips would be much appreciated.

Krik
08-07-2008, 09:23 PM
Set your tables width

sneakyimp
08-07-2008, 09:32 PM
why is that necessary if i've set the width of all the table cells?

Krik
08-07-2008, 09:46 PM
The browsers are setting a default width of 100% for the table and then filling in the space with the cells, instead of leaving a bid void, hence varying them at their discretion. I suspect the varied width of the cells has something to do with the amount of text in the first row.

sneakyimp
08-07-2008, 10:23 PM
I tried preceding that long colspan cell with a row with one TD for each column but it didn't help. Adding a width to the table does seem to make a difference. I suppose that will have to do. thanks.

coldwerturkey
08-07-2008, 11:00 PM
adding a # table width instead of a % width will make a difference, just add up all your td's # width and make that your table's width.

if your tables width is a %, and your td's are #, it doesn't work,

don't bother using css, just <table width='###'> and <td width='##'>

leatherback
08-09-2008, 05:46 AM
Or use pure CSS and don't bother with tables :D