On 16 Dec 2005, at 8:21 am, Justin Makeig wrote: > I can't seem to get the min-width property to have any effect on an > XHTML table element. width does what I would expect it to do, but min > and max-width seem to do nothing in Firefox 1.5 and Safari 2.0.2. (Of > course, they do nothing in IE Win, but that's another thread.) My > problem is that I have some really wide tables with potentially > dozens of columns. I've got a wrapper div that is specified with > overflow: auto. If the table is wider than the wrapper div I'd like > the div to scroll horizontally. This works by setting the table width > to auto. However, if the table is skinnier than the div I'd like the > table to fill up the div horizontally so any vertical scroll bars > will be positioned right next to the table. I would think this would > be a job for min-width. However, it doesn't seem to have an effect on > the table. > > [....] > > Am I off base? Any help would be much appreciated.
The min-width property doesn't really apply to table elements <http://www.w3.org/TR/CSS21/visudet.html#propdef-min-width> Ok, it is a bit more complicated, due to the complexities of the css table model. Have a look at the figure under 17.4: <http://www.w3.org/TR/CSS21/tables.html#q5> you'll see a grey dotted line around the table. That is the anonymous box that holds the whole table (caption, table-rows, etc) together. Your min-width will apply to that anonymous box. But the table-rows (and the thead, tbody elements) will expand or shrink in width, depending on the content of the table-cell boxes. Unless ? Unless if you set the width of the table to be 100%. Because 'width' as applied to the <table> element is really a min-width. Picture this: you have a div that is 500px wide (width set), and you add a table in there with many columns. Give your table a background-colour and a width of 100%. If your table-cells contain each one character, chances are that the table will fit in the div. But add more content to the table-cells, and watch your table expand in width, overflowing the container. The same will happen if your table has a width set to 500px. Demo: <http://dev.l-c-n.com/tables_4/table-width.php> Philippe --- Philippe Wittenbergh <http://emps.l-c-n.com/> ______________________________________________________________________ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ Supported by evolt.org -- http://www.evolt.org/help_support_evolt/