Posted by Ben C on 11/07/07 22:33
On 2007-11-07, dorayme <doraymeRidThis@optusnet.com.au> wrote:
> In article <13j3uddjt1khb61@corp.supernews.com>,
> Ed Jensen <ejensen@visi.com> wrote:
>
>> Perhaps tables are "more forgiving" when it comes to badly coded web
>> sites. <shrug>
>
> Table cells by default grow to fit the content. This shrink to
> fit can be seen as a built-in intelligence.
> That is why you don't see so much content spilling out (and even
> messing up other things outside the table) as in badly made non-table
> layout.
Yes exactly. They also have the unique property that explicit width is
treated as a minimum, which is why content doesn't spill out.
Using auto width floats with min-width rather than width set on them
would do just as well. But people don't use min-width because it doesn't
work in IE...
> But that does not mean it is a desirable thing *on balance* to
> layout with tables. There are arguments that override the pros
> for tables as layout for non tabular data as a general authoring
> practice.
A lot of CSS layouts seem to be built around floats. If display:
inline-block and display: table-cell were more widely supported they
might be better alternatives in some cases.
But really you rarely need display: table-cell. If you have inline-block
you can just use that for centered shrink-to-fit.
It's useful if you want multiple columns that all get the content height
of the highest one. This is possible to sort of do with those border
tricks we've seen ("holy grail" etc.) but table-cell would be better.
And it's useful if you want a layout that looks like a grid. A few sites
these days have complex CSS layouts that contrive the appearance of
tables (look at http://www.t-mobile.de for example), I suspect because
people are revamping their old table sites without wanting to change
anything outwardly.
[Back to original message]
|