Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Edinburgh, UK
    Posts
    402
    Thanks
    2
    Thanked 1 Time in 1 Post

    Table Column Width Problem

    I have a bit of a problem with trying to make my table dispaly properly.

    I want to have a 5 column table with 4 out of the 5 being fixed widths, but the other needs to be variable.

    ----------------------------------------------------------------------------
    |<63px>|<----------variable--------->|<63px>|<--67px-->|<----155px---->|
    ----------------------------------------------------------------------------

    I've tried many different methods and even tried using the source from the forum (as that's a very similar scenario) but nothing seems to want to work!

    Here's the source of the table I'm using:
    Code:
    <table width="100%">
    <tr>
    <td width="63">a</td>
    <td>b</td>
    <td width="63">c</td>
    <td width="67">d</td>
    <td width="155">e</td>
    </tr>
    </table>
    As you can see from the code, i want to be able to have the whole table scale when the browser res changes, but I can't get it to work on any res at all.

    I'm sure there's a really simple solution to this but I'm just not seeing it at all. Any help would be greatly appreciated, cause it's starting to really get to me lol
    Thanks in advance,
    Rich

    "An expert is a person who has made all the mistakes that can be made in a very narrow field."

  • #2
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Have you tried specifying a unit like you did in your ASCII diagram?
    Forget style. Code to semantics. Seperate style from structure, and structure from behaviour.
    I code to specs, and test only in Firefox (unless stated otherwise).

  • #3
    Senior Coder
    Join Date
    Jan 2005
    Location
    Memphis, TN
    Posts
    1,785
    Thanks
    8
    Thanked 131 Times in 129 Posts

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    Edinburgh, UK
    Posts
    402
    Thanks
    2
    Thanked 1 Time in 1 Post
    I don't get this at all. I've been doing that for most of the night and it doesn't work. The only thing it could possibly be is the fact that it's contained within a DIV, but even this doesn't make sense. I can't see how having it contained within a div is going to effect the way that the table works.

    Anyone have any ideas? I'm at a complete loss.
    Rich

    "An expert is a person who has made all the mistakes that can be made in a very narrow field."

  • #5
    Senior Coder
    Join Date
    Jan 2005
    Location
    Memphis, TN
    Posts
    1,785
    Thanks
    8
    Thanked 131 Times in 129 Posts
    Can you post up the code for it?

    If the Div that has the table in it has a fixed width than the table will not collapse.

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    Edinburgh, UK
    Posts
    402
    Thanks
    2
    Thanked 1 Time in 1 Post
    Sure can do. Here's the code with the div included:

    Code:
    <div style="width: 100%; height: auto; border-left: 1px solid #93B6EF; border-right: 1px solid #93B6EF; border-bottom: 0px none #93B6EF; border-top: 1px solid #93B6EF; margin-top: 20px; padding: 0px;">
    <table width="100%" cellpadding="0" cellspacing="0" border="0">
      <tr class="overview_heading">
            <th width="63">&nbsp;&nbsp;</th>
            <th>{L_FORUM}</th>
            <th width="63">&nbsp;{L_TOPICS}&nbsp;</th>
            <th width="69">&nbsp;{L_POSTS}&nbsp;</th>
            <th width="155">&nbsp;{L_LASTPOST}&nbsp;</th>
      </tr>
    </table>
    There are obviously other rows after this, but if i can get one to work I should be able to get them all to work, well that's the how i feel it should lol

    Thanks,
    Rich

    "An expert is a person who has made all the mistakes that can be made in a very narrow field."

  • #7
    Senior Coder
    Join Date
    Jan 2005
    Location
    Memphis, TN
    Posts
    1,785
    Thanks
    8
    Thanked 131 Times in 129 Posts
    Well, that works as well. If you just make a demo page with just that code in it you'll see what I mean. So there is probally something else either above or below it that has a fixed width that stops this particular table from collapsing.

    Do you have a page up so the whole code can be seen?

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    Edinburgh, UK
    Posts
    402
    Thanks
    2
    Thanked 1 Time in 1 Post
    Thanks for helping, I managed to solve the problem. Not exactly sure what I did to make it work, but I messed around with the containing DIVs and it just started working all of a sudden lol If I ever discover what it was that I did to make it work I'll let you know lol


    Thanks again,
    Last edited by Badman3k; 03-14-2005 at 09:48 PM. Reason: Problem Solved
    Rich

    "An expert is a person who has made all the mistakes that can be made in a very narrow field."


  •  

    Posting Permissions

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