SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist artcoder's Avatar
    Join Date
    Aug 2005
    Location
    Planet Earth
    Posts
    599
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Does empty <td> collapse?

    I heard long ago, that if I have empty <td>'s without any &nbsp; or spacer gifs, then it would collapse? Is that still true of modern browsers?

    Because I have a page using table layout with things like...

    <td width="20"></td>

    and I did not encounter any problem in IE6 and Firefox.

    -artcoder (at) webmarksonline.com

  2. #2
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by artcoder
    and I did not encounter any problem in IE6 and Firefox.
    I guess not... but to be safe I'd always use a non breaking space.

    (though of course you shouldn't be using tables for layout but that's really a different argument)
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  3. #3
    SitePoint Evangelist Maujor's Avatar
    Join Date
    Mar 2005
    Location
    Rio de Janeiro - Brazil - South America
    Posts
    409
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <td></td> Collapse;
    <td width="320"></td> Extends 320px wide;
    <td>&nbsp;</td> Extends ( browser dependant) but say, about 5px for text browser set to medium;
    Have a look for yourself:
    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">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Tables</title>
    <style>
    table tr td {border:1px solid #f00;}
    </style>
    </head>
    
    <body>
    
    <table>
    <tr>
    <td></td>
    <td width="320"></td>
    <td>&nbsp;</td>
    </tr>
    </table>
    </body>
    </html>
    Mauricio Samy Silva
    http://www.maujor.com/

  4. #4
    bronze trophy
    Join Date
    Dec 2004
    Location
    Sweden
    Posts
    2,670
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you don't want them to collapse then use
    Code:
    table { empty-cells:show; }
    http://www.w3.org/TR/CSS21/tables.html#empty-cells
    Simon Pieters


Bookmarks

Posting Permissions

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