Table expanding help

Discussion in 'Web Design & Coding' started by k3o, Feb 25, 2006.

  1. k3o

    k3o My name is James VIP Member

    Joined:
    Feb 4, 2004
    Messages:
    413
    Likes Received:
    1
    Location:
    England
    I have a php "navigation system" if you will - if act=portfolio is called is echos my portfolio page into my content td container, same with all my other pages. But on some pages, which are in exactly the same format (shown below) it makes its <td> container slightly wider. How can I stop it, and, no matter what content the <td> has in it, it must NOT expand? Thanks.

    By the way, the format for my content is:

    HTML:
    <div class="subtitle">Title</div>
    <p>Content</p>
     
    k3o, Feb 25, 2006
    #1
    1. Advertisements

  2. k3o

    James Photojournalist

    Joined:
    Dec 24, 2002
    Messages:
    6,662
    Likes Received:
    35
    You would have to specify the TD width to stop this.
     
    James, Feb 25, 2006
    #2
    1. Advertisements

  3. k3o

    k3o My name is James VIP Member

    Joined:
    Feb 4, 2004
    Messages:
    413
    Likes Received:
    1
    Location:
    England
    I have specified this in my CSS - should I hard-code it into the HTML aswell?
     
    k3o, Feb 25, 2006
    #3
  4. k3o

    James Photojournalist

    Joined:
    Dec 24, 2002
    Messages:
    6,662
    Likes Received:
    35
    CSS and table width does not always work, I've had a similar issue to yours. This page pulls data from my DB an outputs it into a table: http://www.ogden2k.net/iedb/movies/
     
    James, Feb 25, 2006
    #4
  5. k3o

    k3o My name is James VIP Member

    Joined:
    Feb 4, 2004
    Messages:
    413
    Likes Received:
    1
    Location:
    England
    Hmm.. so do you suggest I hard-code it into the <td>?

    If not, what did you do to overcome this?
     
    k3o, Feb 25, 2006
    #5
  6. k3o

    k3o My name is James VIP Member

    Joined:
    Feb 4, 2004
    Messages:
    413
    Likes Received:
    1
    Location:
    England
    I have discovered this is due to cell padding: are there any alternatives to using cell padding?
     
    k3o, Feb 25, 2006
    #6
  7. k3o

    SwordWielder Master of Swords VIP Member

    Joined:
    Feb 8, 2003
    Messages:
    375
    Likes Received:
    2
    Location:
    California
    Use the TD width, this is the easiest way around the issues.
     
    SwordWielder, Feb 26, 2006
    #7
  8. k3o

    Nickweb Resident Filmaker Moderator

    Joined:
    Nov 7, 2003
    Messages:
    2,532
    Likes Received:
    27
    Location:
    North Wales, Britain
    cell padding="0" in the table properties eg- <TABLE width="300" cellspacing="1" cellpsacing="0" border="0"></TABLE> I think. It's been a while
     
    Nickweb, Feb 27, 2006
    #8
  9. k3o

    k3o My name is James VIP Member

    Joined:
    Feb 4, 2004
    Messages:
    413
    Likes Received:
    1
    Location:
    England
    I fixed it:

    This is before:

    Code:
    <tr><td id="content"><h1>Title</h1><p>Content</p></td></tr>
    After:

    Code:
    <tr><td><table id="content" cellspacing="4"><tr><td><h1>Title</h1>
    <p>Content</p></td></tr></table></td></tr>
    (oh yeah, i changed the div to h1).

    Monstrous use of tables, but meh, it works.
     
    k3o, Feb 27, 2006
    #9
  10. k3o

    James Photojournalist

    Joined:
    Dec 24, 2002
    Messages:
    6,662
    Likes Received:
    35
    I don't see how that can work properly. :|
     
    James, Feb 27, 2006
    #10
  11. k3o

    k3o My name is James VIP Member

    Joined:
    Feb 4, 2004
    Messages:
    413
    Likes Received:
    1
    Location:
    England
    What part do you mean? The cellspacing spaces the edge of the cell from the <td> container it's in, and somehow doesn't expand.
     
    k3o, Feb 28, 2006
    #11
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.