Table width and columns width

Discussion in 'HTML' started by kris, Nov 17, 2003.

  1. kris

    kris Guest

    Hi
    I've problem with my table. Here is code:

    <TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="200">
    <col width="100" align="left">
    <col width="100" align="left">
    <TBODY>
    <TR>
    <th>Col1</th>
    <th>Col2</th>
    </TR>
    </TBODY>
    </TABLE>

    <TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="200">
    <col width="100" align="left">
    <col width="100" align="left">
    <TBODY>
    <tr>
    <td>Administratorzy</td>
    <td>Administratorzy</td>
    </tr>
    <tr>
    <td>Administratorki</td>
    <td>Administratorki</td>
    </tr>
    </TBODY>
    </TABLE>

    Why two tables have different width? What I can do to fix it? I want this
    same width!!

    thanks
    kris
    kris, Nov 17, 2003
    #1
    1. Advertising

  2. kris

    C Garrod Guest

    There is no COL tag.

    Only <TR></TR> Table row and <TD></TD> Table data.

    The reason the cells are not the same width is due to the content it is
    being pushed against the side of the cell and increasing the set width.

    Try this...

    <html>
    <head><title>Test</title></head>
    <body>
    <TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="300">

    <TBODY>
    <TR>
    <th>Col1</th>
    <th>Col2</th>
    </TR>
    </TBODY>
    </TABLE>

    <TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="300">

    <TBODY>
    <tr>
    <td>Administratorzy</td>
    <td>Administratorzy</td>
    </tr>
    <tr>
    <td>Administratorki</td>
    <td>Administratorki</td>
    </tr>
    </TBODY>
    </TABLE>
    </body>
    </html>

    "kris" <> wrote in message
    news:bpau1j$qb0$...
    > Hi
    > I've problem with my table. Here is code:
    >
    > <TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="200">
    > <col width="100" align="left">
    > <col width="100" align="left">
    > <TBODY>
    > <TR>
    > <th>Col1</th>
    > <th>Col2</th>
    > </TR>
    > </TBODY>
    > </TABLE>
    >
    > <TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="200">
    > <col width="100" align="left">
    > <col width="100" align="left">
    > <TBODY>
    > <tr>
    > <td>Administratorzy</td>
    > <td>Administratorzy</td>
    > </tr>
    > <tr>
    > <td>Administratorki</td>
    > <td>Administratorki</td>
    > </tr>
    > </TBODY>
    > </TABLE>
    >
    > Why two tables have different width? What I can do to fix it? I want this
    > same width!!
    >
    > thanks
    > kris
    >
    >
    C Garrod, Nov 17, 2003
    #2
    1. Advertising

  3. kris

    kris Guest

    U¿ytkownik "C Garrod" <> napisa³ w wiadomo¶ci
    news:bpb0v7$okc$...
    > There is no COL tag.
    >
    > Only <TR></TR> Table row and <TD></TD> Table data.
    >
    > The reason the cells are not the same width is due to the content it is
    > being pushed against the side of the cell and increasing the set width.
    >
    > Try this...
    >
    > <TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="300">


    But I want, that width my table was allways constant = 200 !!!

    kris
    kris, Nov 17, 2003
    #3
  4. C Garrod wrote:

    > There is no COL tag.


    I would suggest that you read the HTML specification:

    <http://www.w3.org/TR/html4/struct/tables.html#h-11.2.4.2>
    Owen Jacobson, Nov 17, 2003
    #4
  5. kris

    Steve Pugh Guest

    "kris" <> wrote:

    >I've problem with my table. Here is code:
    >
    ><TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="200">
    > <col width="100" align="left">
    > <col width="100" align="left">
    ><TBODY>
    ><TR>
    > <th>Col1</th>
    > <th>Col2</th>
    ></TR>
    ></TBODY>
    ></TABLE>


    That's a funny looking table. Two headings and no data. What are those
    <th>s supposed to be the headings for?

    ><TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="200">
    > <col width="100" align="left">
    > <col width="100" align="left">
    ><TBODY>
    > <tr>
    > <td>Administratorzy</td>
    > <td>Administratorzy</td>
    > </tr>
    > <tr>
    > <td>Administratorki</td>
    > <td>Administratorki</td>
    > </tr>
    ></TBODY>
    ></TABLE>
    >
    >Why two tables have different width?


    Because the content you've put in the second table is wider than 100px
    with no characters that are permitted line breaking points. What else
    is the browser supposed to do?

    >What I can do to fix it?


    Don't put such large content in there. Of course as you have no
    knowledge of the user's font size you can't even tell if a really
    short word will fit into 100px.

    >I want this same width!!


    Getting the same width in the two tables would be easy if you combined
    them into one table. Although I can't tell what you're real data is
    like I might hazard a guess that this would in fact make sense. Are
    the <th> elements in the first table actually the headings for the
    data in the second table? If so then this should definitely be one
    table.

    Getting the cells to be exactly 100px is a presentation matter and
    thus somethin for CSS. You can use table-layout:fixed; to suggest that
    the stated widths override the content, but the results may be hard to
    use.

    A better idea would be to stop trying to force the content into a set
    width and allow the content to determine the width.

    Steve

    --
    "My theories appal you, my heresies outrage you,
    I never answer letters and you don't like my tie." - The Doctor

    Steve Pugh <> <http://steve.pugh.net/>
    Steve Pugh, Nov 17, 2003
    #5
  6. kris

    Kevin Scholl Guest

    kris wrote:

    >>There is no COL tag.
    >>
    >>Only <TR></TR> Table row and <TD></TD> Table data.
    >>
    >>The reason the cells are not the same width is due to the content it is
    >>being pushed against the side of the cell and increasing the set width.
    >>
    >>Try this...
    >>
    >><TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="300">

    >
    >
    > But I want, that width my table was allways constant = 200 !!!


    Then you need, to use shorter terms in the cells. :)

    --

    *** Remove the DELETE from my address to reply ***

    ======================================================
    Kevin Scholl http://www.ksscholl.com

    ------------------------------------------------------
    Information Architecture, Web Design and Development
    ------------------------------------------------------
    We are the music makers, and we are the dreamers of
    the dreams...
    ======================================================
    Kevin Scholl, Nov 18, 2003
    #6
  7. kris

    Sid Ismail Guest

    On Mon, 17 Nov 2003 18:50:04 +0100, "kris" <> wrote:

    :
    : U¿ytkownik "C Garrod" <> napisa³ w wiadomo¶ci
    : news:bpb0v7$okc$...
    : > There is no COL tag.
    : >
    : > Only <TR></TR> Table row and <TD></TD> Table data.
    : >
    : > The reason the cells are not the same width is due to the content it is
    : > being pushed against the side of the cell and increasing the set width.
    : >
    : > Try this...
    : >
    : > <TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="300">
    :
    : But I want, that width my table was allways constant = 200 !!!
    :
    : kris
    :


    Why do you have two tables? You can TR's in one huge table? URL?

    Sid
    Sid Ismail, Nov 18, 2003
    #7
  8. kris

    kris Guest

    Uzytkownik "Sid Ismail" <> napisal w wiadomosci
    news:...
    >
    > Why do you have two tables? You can TR's in one huge table? URL?


    in Mozilla this code:
    <DIV STYLE="WIDTH: 600px; HEIGHT: 50px; PADDING: 0px; MARGIN: 0px">
    <TABLE border="1" CELLPADDING="2" CELLSPACING="0" WIDTH="580">
    <THEAD>
    <TR><th>Column 1</th><th>Column 2</th></TR>
    </THEAD>
    <TFOOT>
    <TR><td colspan="2" align="center">This is footer</td></TR>
    </TFOOT>

    <TBODY STYLE="overflow:scroll; HEIGHT: 100px;">
    <tr><td>cell 1 a</td><td>cell 1 b</td></tr>
    <tr><td>cell 2 a</td><td>cell 2 b</td></tr>
    <tr><td>cell 3 a</td><td>cell 3 b</td></tr>
    <tr><td>cell 4 a</td><td>cell 4 b</td></tr>
    <tr><td>cell 5 a</td><td>cell 5 b</td></tr>
    <tr><td>cell 6 a</td><td>cell 6 b</td></tr>
    <tr><td>cell 7 a</td><td>cell 7 b</td></tr>
    <tr><td>cell 8 a</td><td>cell 8 b</td></tr>
    <tr><td>cell 9 a</td><td>cell 9 b</td></tr>
    <tr><td>cell 10 a</td><td>cell 10 b</td></tr>
    </TBODY>
    </TABLE>
    </DIV>

    scrolling body of table, but no in IE
    than I try do this function in IE

    kris
    kris, Nov 18, 2003
    #8
  9. kris

    rf Guest

    "kris" <> wrote in message
    news:bpbrm2$o6e$...
    >
    > Uzytkownik "Sid Ismail" <> napisal w wiadomosci
    > news:...
    > >
    > > Why do you have two tables? You can TR's in one huge table? URL?

    >
    > in Mozilla this code:


    <snip code>

    That is *not* a good idea. With Mozilla there is no way to scroll that tbody
    except with the mouse and the vertical scroll bar. Keyboard arrow and page
    up/down keys don't work. Mouse wheel doesn't work. It's worse than an iframe
    :)

    IMHO IE does a much better job of the table.

    Cheers
    Richard.
    rf, Nov 18, 2003
    #9
  10. kris

    Mark Parnell Guest

    Sometime around Tue, 18 Nov 2003 01:38:18 GMT, rf is reported to have
    stated:
    >
    > IMHO IE does a much better job of the table.


    <Picks self up off floor>Did I read that correctly? IE does something
    *better* than Mozilla? Reality is crumbling around me!

    --
    Mark Parnell
    http://www.clarkecomputers.com.au
    Mark Parnell, Nov 18, 2003
    #10
  11. kris

    rf Guest

    "Mark Parnell" <> wrote in message
    news:...
    > Sometime around Tue, 18 Nov 2003 01:38:18 GMT, rf is reported to have
    > stated:
    > >
    > > IMHO IE does a much better job of the table.

    >
    > <Picks self up off floor>Did I read that correctly? IE does something
    > *better* than Mozilla? Reality is crumbling around me!


    Sometimes a tool that does not support all the new fangled bells and
    whistles actually works better than one that does and then scrunches an
    entire table up into a 1 inch space with a scroll bar :)

    Cheers
    Richard.
    rf, Nov 18, 2003
    #11
  12. kris

    kris Guest

    U¿ytkownik "rf" <> napisa³ w wiadomo¶ci
    news:eKeub.15081$...
    > That is *not* a good idea. With Mozilla there is no way to scroll that

    tbody
    > except with the mouse and the vertical scroll bar. Keyboard arrow and page
    > up/down keys don't work. Mouse wheel doesn't work. It's worse than an

    iframe

    ok
    but IE don't suport to scroling TBODY? why? I read that is standard function
    in HTML 3.2.
    To do this same function I must use DIV tags (layers) :(

    kris
    kris, Nov 18, 2003
    #12
    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. AndrewF
    Replies:
    1
    Views:
    740
    Bruce Barker
    Oct 10, 2005
  2. Sean Jorden
    Replies:
    1
    Views:
    584
    laurie
    Aug 19, 2003
  3. =?iso-8859-1?q?Tobias_M=FCller?=

    converting xml to table width multiple columns by xsl

    =?iso-8859-1?q?Tobias_M=FCller?=, Sep 6, 2005, in forum: XML
    Replies:
    4
    Views:
    3,391
    Andy Dingley
    Sep 6, 2005
  4. Jacksm
    Replies:
    2
    Views:
    837
    Paul Chalekian
    Nov 21, 2006
  5. ssk
    Replies:
    5
    Views:
    5,458
    Jukka K. Korpela
    Oct 30, 2006
Loading...

Share This Page