SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    * size in tables??

    On a new site I want to be able to say that one cell of a table is exactly 140 px and that a few other cells are things like 1 px and 20 px and then that the middle cell is whats left. I know you can do this in frames by quoting * as the size value but how can I do this in html with tables??

    I want to do this so that users of different resolutions will all see the site as they should!!

    many thanks
    rick
    RBoycey

  2. #2
    Gone!
    Join Date
    Aug 2001
    Location
    Witty Location Parody
    Posts
    3,889
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you have a row in a table with 5 cells then if you specify each one with its own width value, width="140" etc etc the one that is left will be what ever space is left, either of the screen if you specified the table width as a percentage or in pixels if you specified the table width in pixels.

    If you want the table to be viewable for all resolutions using fixed width cells then you will have to design for your lowest resolution and have viewers with higher resoltuions see a seemingly more squashed up table........or just use percentage values in the width attributes so the table expands.

    Hope this what you mean,


    Code:
    <table width="800" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="140">&nbsp;</td>
        <td width="20">&nbsp;</td>
        <td>&nbsp;</td> <--------------This will be 800-(140+140+20+20)=480
        <td width="20">&nbsp;</td>
        <td width="140">&nbsp;</td>
      </tr>
    </table>

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I tried this. It doesn't work. It just stays as it is, WRONG!

    Is there anything I can use that is something like equiv to position absolute??

    Many Thanks
    Rick
    RBoycey

  4. #4
    Gone!
    Join Date
    Aug 2001
    Location
    Witty Location Parody
    Posts
    3,889
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Give us an example of what you have online and itll be easier to help

  5. #5
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Define your TABLE like so:

    <table width="800">
    <tr>
    <td width="20">
    <td width="80">
    <td width="600">this is the rest</td>
    <td width="80">
    <td width="20">
    </tr>
    </table>

    You could do one of two things. If the TABLE itself has a fixed width like above, then you could simply calculate the TD containing "the rest" by subtracting to total amount of pixels of the TD's from the width of the TABLE. In the above case the width of the middle cell would be 600.

    If your TABLE was variable with (width="100%") then you would change 600 to 100%. The browser calculates the fixed widths first then goes back to the percentages and assigns 100% of what is left. This will cause the middle cell to expand to fill the available space, not the entire window. It's best to stay away from the wild card (*) and use actual numbers. It's easier to check your math that way.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  6. #6
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by glenplake
    Code:
    <table width="800" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="140">&nbsp;</td>
        <td width="20">&nbsp;</td>
        <td>&nbsp;</td> <--------------This will be 800-(140+140+20+20)=480
        <td width="20">&nbsp;</td>
        <td width="140">&nbsp;</td>
      </tr>
    </table>
    Glen, your numbers are off, you allow 800 pixels for the entire TABLE. Then you subtract 320 from 800 and get 800? In your example, the middle cell would be 480 not 800.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  7. #7
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK,

    The ideas didn't work...

    I set the cell width to 100% and it just took over the rest of the table. It ignored the fixed width's of the other cells and compressed 'em as much as it could.

    When I left it blank, another problem; it just made the cell as small as it could, i.e. fitted it to the

    It will go to the correct size if I add loads of (more than one line) text.

    If it ain't gonna work, I can just set the table width to something like 600 and then use a smaller area for the content.

    Looking forward to your reply...

    Rick
    RBoycey

  8. #8
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: * size in tables??

    Originally posted by rboycey
    On a new site I want to be able to say that one cell of a table is exactly 140 px and that a few other cells are things like 1 px and 20 px and then that the middle cell is whats left. I know you can do this in frames by quoting * as the size value but how can I do this in html with tables??

    I want to do this so that users of different resolutions will all see the site as they should!!

    many thanks
    rick
    Just to warn you sometimes not specifying exactly with using the px. The table may and can screw up what it looks like in some browsers. I am not sure why you just can't put in the data (unless you are creating an adjustable table).

    Also just as an addon. When positioning or using box specifications I always try to place 'px' in with the number makes it far more exacting on all browsers.
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.

  9. #9
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I am not sure why you just can't put in the data (unless you are creating an adjustable table).
    I am just trying to make sure that the site will look good on all browsers and resolutions, without doing different versions for different resolutions.

    I may be being paranoid, but since I started this site I have done re-design after re-design and got no-where in terms of content and as a result no where towards a profitable site with decent visits!

    I am getting some graphics done for me, and they should be ready soon(ish), so I wanted this site ready...

    Well Thanks for all the help, so far...
    Rick
    RBoycey

  10. #10
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have to have something INSIDE the cell to keep it that correct size.
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  11. #11
    SitePoint Enthusiast
    Join Date
    Mar 2001
    Posts
    67
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There is things inside the cell, but as it is a template a few of the pages don't have stuff thats L-O-N-G enough to fit in.

    Ok, lets try a new question...

    Is there any way that I can make the browser STRICTLY observe what i have put for the cell widths...

    I added some new content (a rather large table) last night and found it squashed the menu bar, and then the page after (small table, small pic etc) hadn't got enough width to fill the cell so it (the browser) made the main cell smaller and the menu bar larger??

    Thanks
    Rick
    RBoycey

  12. #12
    Gone!
    Join Date
    Aug 2001
    Location
    Witty Location Parody
    Posts
    3,889
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by creole

    Glen, your numbers are off, you allow 800 pixels for the entire TABLE. Then you subtract 320 from 800 and get 800? In your example, the middle cell would be 480 not 800.
    Actually I subtract (140+140+20+20) from 800 if you have another looky

    Code:
    <td> </td> <--------------This will be 800-(140+140+20+20)=480


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
  •