Re: CSS vs. Tables - When Tables win
Mario T. Lanza <mlanza@lycos.com>:[color=blue]
>
> I've been working on a 3-column layout where the center column is of a
> fixed width (230px wide).[/color]
Hopefully only used for bitmap images.
[color=blue]
> I have been designing for Firefox and IE and routinely viewing the
> results in both.[/color]
Fascist!!1
[color=blue]
> My original aspiration was to avoid tables.[/color]
And of course you had a look at the various sites that describe in detail
how other people tried to build layouts like yours and similar ones.
Assumed (pseudo) code following.
[color=blue]
> I positioned the center column first using "auto" left/right margins and
> absolute positioning to achieve column centering.[/color]
#foo {
width: 230px;
margin: 0 auto;
position: absolute; top: 0; right: ?; bottom: 0; left: ?;
}
Why both?
[color=blue]
> I then positioned the left/right columns
> (floating both left, 50% width on each)[/color]
.bar {
float: left; width: 50%;
}
[color=blue]
> over top of the absolutely positioned center column.[/color]
<body><.bar #bar1/><.bar #bar2/><#foo/></body>
[color=blue]
> By setting right padding and left padding
> respectively on the left and right columns,[/color]
.bar1 {padding-right: 115px;}
.bar2 {padding-left: 115px;}
[color=blue]
> (Sorry I already trashed the CSS code!)[/color]
Why?
[color=blue]
> The trouble was with Firefox. The links shown in the
> absolutely positioned middle column could not be clicked.[/color]
Of course not, if #bar1 and #bar2 are higher in stacking. You might had
been able to solve this with 'z-index', but I'm not sure.
[color=blue]
> This probably resulted from the overlapping left and right columns.[/color]
Indeed. Congratulations, most people don't think of that.
[color=blue]
> In the end, I converted this easily to a table-based layout which
> works fine.[/color]
Depending on your mark-up, it would have been quite easy to fake a table
for Firefox and other browsers of similar capability, like so:
<body><.bar/><#foo/><.bar/></body>
html {display: table}
body {display: table-row}
.bar,
#foo {display: table-cell}
I'm not sure, but IIRC IE ignores all "display: table-*" like it should.
If that's not the case you would need to use some advanced selectors, that
IE doesn't support.
Of course it's not enough to test such a layout in just two browsers.
[color=blue]
> I wanted to avoid the table if only for better semantic
> markup and faster display times on page loads.[/color]
Personally I think, a simple three-cell layout-table can be justified. The
Safari developpers put a page online, that sums the reason up quite well,
but I'm too lazy to search for it now. (They used a little more nonsense
mark-up than IMO necessary, though.)
[color=blue]
> Q1. Anyone ever created a three-column, pure CSS layout where the
> center column is fixed and the left/right columns fluid[/color]
Probably, the real problems arise only with footers.
<http://css-discuss.incutio.com/?page=ThreeColumnLayouts> is a good
starting point for a search.
Does anyone know an interactive approach like
<http://webdesign.crissov.de/temp/3cols/interactive> with more options and
being better tested?
[color=blue]
> I can see why so may web designers prefect fixed-width layouts.
> They're far easier to control.[/color]
Only that control is nothing a webdesigner has.
[color=blue]
> Q2. Anyone know if the W3C is proposing any new standards for a future
> release of the CSS spec that will better handle the issue of fitting
> indeterminite and determinate width boxes into a container so that the
> entire width is used up?[/color]
Like shown, the various table values for the 'display' property can
*already* do that. Only in supporting browsers, of course.
[color=blue]
> Q3. Is there a suggestion box (email) to which I may send suggestions
> to the W3C for consideration?[/color]
There's a mailing list (<www-style@w3.org>) and its archive
(<http://lists.w3.org/Archives/Public/www-style/>), where you'll find a
number of mails wanting something like you do, mostly not knowing or
accepting "display: table-*", because IE doesn't support it (yet).
--
"A wise man gets more use from his enemies than a fool from his friends."
Baltasar Gracian |