Results 1 to 6 of 6

Thread: Browser/table auto resizing

  1. #1
    Join Date
    Mar 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Browser/table auto resizing

    How do I automatically resize a table whenever the viewer resizes his browser window? If the window is big, then more columns should be visible. (The table also has vertical and horizontal scroll bars.)

    This should be similar to Googlw Maps where the map becomes smaller/bigger as you resize your window. Do they constantly reload?

    Thanks!

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I'm confused.

    All you need to do to make table size relate to window size is use percents:
    <table width=50% height=50%>, etc. The same can be applied to <td> and <tr> as well.
    That will make it relate to how much space it has. (If its smaller than the window, say in the cell of another table, then it will just be x% of that space.

    That should solve your problem.

    Except... you said that 'more columns should be visable' 'if the window is big', so.... hmm?

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    If more columns become visible as the window's size is increased, then the table's size must be staying the same
    djr33: As the values for height and width you specified contain %, a non-numeric character, you need to surround them with quotes:
    Code:
    <table width="50%" height="50%">
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Mar 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Right, the width/height of the columns/rows must not change. Like Google Maps - the map doesn't get distorted when the window resizes, you just see less.

    You're right, the table doesn't change size, just how much of it you see. Maybe if I put it inside a div container with a % height/width???

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Yes, that would work. The content would need to have a fixed height/width, though, in pixels.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Mar 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Yup, it worked

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
  •