thead & tbody width

Discussion in 'HTML' started by rukkie, Dec 8, 2006.

  1. rukkie

    rukkie Guest

    Hi,

    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 ?
     
    rukkie, Dec 8, 2006
    #1
    1. Advertising

  2. Scripsit rukkie:

    > I have a "small" problem, with a "big" table. The table consist of 27
    > cols and a lot of rows.


    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
    table?

    > The content of the cells can vary.


    It would be odd if they couldn't.

    > Every cell has his defined width="xyzpx".


    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.

    > Nevertheless, as some content is larger
    > than the defined width,


    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?

    > the cell is stretched (this is the normal
    > behaviour I assume and I don't have problems with it ..).


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

    > 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


    "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
    confusion.

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

    > ...So at the end , the header cells do not correspond anymore with the
    > body cells ....


    You seem to managed to create that 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 ?


    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")
    http://www.cs.tut.fi/~jkorpela/
     
    Jukka K. Korpela, Dec 8, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David L

    thead in datagrid

    David L, Jul 29, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    508
    S. Justin Gengo
    Jul 29, 2003
  2. AndrewF
    Replies:
    1
    Views:
    845
    Bruce Barker
    Oct 10, 2005
  3. Christian Schmidt

    finishing a thead

    Christian Schmidt, Aug 21, 2003, in forum: Java
    Replies:
    3
    Views:
    775
    Adam Maass
    Aug 25, 2003
  4. TonyV
    Replies:
    24
    Views:
    2,033
    dorayme
    Jan 10, 2008
  5. toffee

    get thead width and height ?

    toffee, Nov 20, 2006, in forum: Javascript
    Replies:
    1
    Views:
    167
    Kunkhmer
    Nov 20, 2006
Loading...

Share This Page