Results 1 to 4 of 4

Thread: Algorithm for figuring out width of td

  1. #1

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945

    Algorithm for figuring out width of td

    So I've been doing some experimenting and I'm wondering if anyone else has played with this: How many pixels in width should be supplied for the average character or combination of characters.

    I'm trying to figure out how wide to make my table columns in pixels based on the maximum number of characters that are in that column. I know that I can just not specify a width and it will fill out the table fairly nicely most of the time, but what if I want it to be exact?

    Thoughts, suggestions?
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  2. #2
    Ex-Super Mod'rater Electroman's Avatar
    Join Date
    Sep 2000
    Location
    Newcastle, England
    Posts
    4,349
    I've often wondered this but thought it would be impractical in the end with all fonts being different sizes and individual characters being different again. I find using "NOWRAP" in the TD tag does the job most the time. However its not useful when you want to calculate the next colums width by taking the last ones away. I'm sure this will be along the line you have made this thread but i just wanted to add to your question:
    Can you find out how much of a table is left unused. Like when using frames you can use the * but you can't in tables, why not .
    When your thread has been resolved please edit the original post in the thread ()
    and amend "-[RESOLVED]-" to the end of the title and change the icon to , Thank you.

    When posting Code use the [VBCode]Code Here[/VBCode] tags to be able to use the code highlighting.

  3. #3

    Thread Starter
    Frenzied Member ober0330's Avatar
    Join Date
    Dec 2001
    Location
    OH, USA
    Posts
    1,945
    Well, I think that would be a simple solution. If you are building your table up dynamically, just keep track of what is being used up and then subtract that from your total width.

    In my case, if I would decide to use a set width for the entire table, I have the issue of making sure that all my columns fit within that width... and for what I'm doing, that's not the case. The width of the table is based on the width of the sum of the columns' width.... and hence we go back to my origional problem.
    format your code!! - [vbcode] [/vbcode]

    ANSWERS CAN BE FOUND HERE!!

    my personal company

  4. #4
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    It's not possible to calculate it because the user might be using a different font, a different size, you get the idea.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

Posting Permissions

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



Click Here to Expand Forum to Full Width