thead & tbody width

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I have a "small" problem, with a "big" table. The table consist of 27
cols and a lot of rows. The content of the cells can vary. Every cell
has his defined width="xyzpx". Nevertheless, as some content is larger
than the defined width, the cell is stretched (this is the normal
behaviour I assume and I don't have problems with it ..). But the
problem is that the header cells defined in the thead section are not
equally stretched as it does not know what is happening in the tbody
...So at the end , the header cells do not correspond anymore with the
body cells .... Is there somebody who has solved this kind of problem ?
I want to keep the thead part, because I want it fixed (not scrolling
vertically if there are many rows in the table). Summarized : how can
you keep the thead fixed vertically but having the same horizontal
width as the body cells in the table? Anyone ?

Re: thead & tbody width

Scripsit rukkie:

Quoted text here. Click to load it

Post the URL so that we can make suggestions on making the table more
useful. Do you really expect someone to _read_ or otherwise use such a

Quoted text here. Click to load it

It would be odd if they couldn't.

Quoted text here. Click to load it

Remove them. You're now using wrong syntax, you're now setting width in
pixels, and you should use width settings (normally in CSS) only to solve
some problems you've observed, instead of using them routinely, just
_creating_ problems.

Quoted text here. Click to load it

Apparently that may happen. If you set a cell's width to, say, 60 pixels, it
is quite possible that even a single letter is too wide to fit in. You
remember, don't you, that the user has the final word on font size?

Quoted text here. Click to load it

Fine. And maybe you'll notice that you don't even need to set the width at

Quoted text here. Click to load it

"It", the browser, knows well what is happening in the tbody, since it does
not format the table until it has read and processed all of it - which is
why it may take some seconds before the user sees the table, even if the
connection is fast.

However you can break this by using table-layout: fixed in CSS. Then you
would need to deal with the consequences, which can be rather bad but do
_not_ included different widths for cells in one column.

Instead, you table structure is probably wrong, so that the header cells are
not recognized as belonging to columns in the intended way. Using a
validator may reveal some syntax errors, but it won't reveal problems like
different number of cells in different rows, which often causes considerable

As usual, posting the URL without being asked to do so would have helped you
to get a faster and friendlier response.

Quoted text here. Click to load it

You seem to managed to create that problem.

Quoted text here. Click to load it

Now that's a completely different question. Sorry, but I already spent the
time allocated to responding to your message, when I discussed the problem
that you created when trying to solve the real problem. HTH. HAND.

Jukka K. Korpela ("Yucca")

Site Timeline