How to set a minwidth to a table

Discussion in 'HTML' started by Stefan Mueller, Nov 16, 2005.

  1. Is there any possibility to set a minwidth to a table so if you reduce the
    width of the browser window the page gets not smaller but that you get a
    horizontal scroll bar?

    Stefan

    ====================================

    <html>
    <body>
    <table width = "100%" border = "0" align = "center">
    <tr>
    <td width = "50%">
    Text left
    </td>

    <td width = "50%" align = "right">
    Text left
    </td>
    </tr>
    </table>
    </body>
    </html>

    ====================================
    Stefan Mueller, Nov 16, 2005
    #1
    1. Advertising

  2. __/ [Stefan Mueller] on Wednesday 16 November 2005 02:21 \__

    > Is there any possibility to set a minwidth to a table so if you reduce the
    > width of the browser window the page gets not smaller but that you get a
    > horizontal scroll bar?
    >
    > Stefan
    >
    > ====================================
    >
    > <html>
    > <body>
    > <table width = "100%" border = "0" align = "center">
    > <tr>
    > <td width = "50%">
    > Text left
    > </td>
    >
    > <td width = "50%" align = "right">
    > Text left
    > </td>
    > </tr>
    > </table>
    > </body>
    > </html>
    >
    > ====================================



    I think that the answer would be no -- there is no reserved mechanism for
    doing so. I suggest constructing a transparent PNG file which is, let us
    say, 800 pixels wide and 1 pixel in height. Put it somewhere in the table
    and assuming you have no columns (cells), you should be fine. In fact,
    putting such an element /outside/ the table would do the trick too, re-
    gardless of the spread of table cells.

    Hope it helps,

    Roy

    --
    Roy S. Schestowitz | It is no longer uncommon to be uncommon
    http://Schestowitz.com | SuSE Linux | PGP-Key: 0x74572E8E
    3:30am up 12 days 23:28, 4 users, load average: 1.30, 0.82, 0.46
    http://iuron.com - next generation of search paradigms
    Roy Schestowitz, Nov 16, 2005
    #2
    1. Advertising

  3. Stefan Mueller

    dorayme Guest

    > From: "Stefan Mueller" <>
    >
    > Is there any possibility to set a minwidth to a table so if you reduce the
    > width of the browser window the page gets not smaller but that you get a
    > horizontal scroll bar?
    >
    > Stefan
    >
    > ====================================
    >
    > <html>
    > <body>
    > <table width = "100%" border = "0" align = "center">
    > <tr>
    > <td width = "50%">
    > Text left
    > </td>
    >
    > <td width = "50%" align = "right">
    > Text left
    > </td>
    > </tr>
    > </table>
    > </body>
    > </html>
    >
    > ====================================
    >

    There would be a number of ways to do what you might want. If
    you have a table at 100% and are doing what you indicate and the
    table is the all important thing in your page, then <body
    style="min-width:800px"> will work in some good browsers to
    bring up the scrollbar. But what you want is unclear because
    what do you mean by "the page gets not smaller". By putting in
    width as 100% for the table, this becomes a murky idea (ie.
    suppose the screen is 1600 px wide and the right text is right
    at right. When the window is reduced do you really want the
    scollbar to come on right away? Surely not. In other words, you
    need to think thru what is wanted first). Leave the 100% out and
    see what happens, combine the min-width for the body with no
    100%, or with the 100%...

    --
    dorayme
    dorayme, Nov 16, 2005
    #3
  4. Stefan Mueller

    Toby Inkster Guest

    Stefan Mueller wrote:

    > Is there any possibility to set a minwidth to a table so if you reduce the
    > width of the browser window the page gets not smaller but that you get a
    > horizontal scroll bar?


    TABLE { min-width: 500px; }

    but that's not supported by MSIE.

    --
    Toby A Inkster BSc (Hons) ARCS
    Contact Me ~ http://tobyinkster.co.uk/contact
    Toby Inkster, Nov 16, 2005
    #4
  5. > I think that the answer would be no -- there is no reserved mechanism for
    > doing so. I suggest constructing a transparent PNG file which is, let us
    > say, 800 pixels wide and 1 pixel in height. Put it somewhere in the table
    > and assuming you have no columns (cells), you should be fine. In fact,
    > putting such an element /outside/ the table would do the trick too, re-
    > gardless of the spread of table cells.



    Yea, I've also thought about something like adding a blank image with a
    fixed width (800px) but the problem is that even if I set its height to zero
    it needs some vertical space:

    <html>
    <body>
    <table width = "100%" border = "0">
    <tr>
    <td>
    <img src = "size-1x1.gif" width = "800px" height = "0" border =
    "0">
    <hr>
    </td>
    </tr>
    </table>
    </body>
    </html>

    Stefan

    PS: According to other posts min-width (<table width = "100%" style =
    "min-width:800px" border = "0">) would be a nice solution but unfortunately
    it's not working with the Internet Explorer.
    Stefan Mueller, Nov 17, 2005
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Williams
    Replies:
    2
    Views:
    1,107
    Jacob Yang [MSFT]
    Aug 12, 2003
  2. Alan Silver
    Replies:
    0
    Views:
    514
    Alan Silver
    Dec 21, 2005
  3. Manav
    Replies:
    0
    Views:
    763
    Manav
    Oct 15, 2003
  4. Harald Kirsch
    Replies:
    4
    Views:
    2,815
    Harald Kirsch
    Aug 31, 2004
  5. Rio
    Replies:
    4
    Views:
    1,172
Loading...

Share This Page