How to set a minwidth to a table

S

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>

====================================
 
R

Roy Schestowitz

__/ [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
 
D

dorayme

From: "Stefan Mueller said:
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%...
 
T

Toby Inkster

Stefan said:
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.
 
S

Stefan Mueller

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,900
Latest member
Nell636132

Latest Threads

Top