www.webdeveloper.com
Results 1 to 6 of 6

Thread: Useless colspan

  1. #1
    Join Date
    Nov 2002
    Location
    Canada
    Posts
    65

    Useless colspan

    What DTD will actually let the colspan work properly?

    Im using XHTML1.0 Trans and when I have two cells below a cell with colspan=2, I cant set the width of either of the bottom cells? Whats up?

    Is this by design? Any ideas?

    Thanks.
    Phil
    "With your feet on the air, and your head in the ground"

  2. #2
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    Like this?
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>width in td</title>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
    </head>
    <body>
    <table border="1" cellpadding="0" cellspacing="0" summary="">
    <tr><td colspan="2">a</td></tr>
    <tr><td width="200px">b</td><td width="100px">c</td></tr>
    </table>
    </body>
    </html>

  3. #3
    Join Date
    Nov 2002
    Location
    Canada
    Posts
    65
    Almost, sorry I should have given an example.

    The table width is 100% and the lower right cell should be automatic. The lower left cell being 15px.

    Code:
    <table width="100%">
    <tr><td colspan="2">blah</td></tr>
    <tr><td width="15">img</td><td [width="100%"]>rightcell</td></tr>
    </table>
    When I put width="100%" in rightcell it squishes the img cell regardless of width.
    Phil
    "With your feet on the air, and your head in the ground"

  4. #4
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    This is the way it works; the 100% over rides the value in the left cell.
    There is no need to have 100% in the right cell, it will stretch automatically to take up the rest of the width of the table.
    This is all that is needed:
    Code:
    <table width="100%">
    <tr><td colspan="2">blah</td></tr>
    <tr><td width="15">img</td><td>rightcell</td></tr>
    </table>

  5. #5
    Join Date
    Nov 2002
    Location
    Canada
    Posts
    65
    No, thats why I put the brackets around [width=100%] because when its not there, the leftcell is too big and doesnt stay at width=15 and when it is there, its squishes down to whatever is in its cell.

    I dont mind the second part, it makes sense. But having a table with width 100% and the left cell having width 15, it should work.
    Phil
    "With your feet on the air, and your head in the ground"

  6. #6
    Join Date
    Apr 2003
    Location
    Netherlands
    Posts
    21,654
    15px is very narrow so any text will be squashed, images will retain their true width.
    Can you give a full example/page?
    The problem maybe in another container or css.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles