Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 21st, 2005, 12:54 AM
Mario T. Lanza
Guest
 
Posts: n/a
Default CSS vs. Tables - When Tables win

Greetings,

I've been working on a 3-column layout where the center column is of a
fixed width (230px wide). The center column must always be 230px and
the columns on the right/left (always the same size as eachother) must
always take up the remaining width of the browser.

I have been designing for Firefox and IE and routinely viewing the
results in both.

My original aspiration was to avoid tables. I positioned the center
column first using "auto" left/right margins and absolute positioning
to achieve column centering. I then positioned the left/right columns
(floating both left, 50% width on each) over top of the absolutely
positioned center column. By setting right padding and left padding
respectively on the left and right columns, I was able to make the
inner text part away from the overlapped center column. (Sorry I
already trashed the CSS code!)

Here's the interesting thing. This worked as far as achieving the
desired layout. The trouble was with Firefox. The links shown in the
absolutely positioned middle column could not be clicked. This
probably resulted from the overlapping left and right columns. --
Imagine the browser is your stage and a column sits dead in the middle
of it. Then imagine that the curtains draw closed so that seam
between them runs up and down exactly in the middle. The curtains
prevent you from touching column behind them even though they are
transparent curtains! (IE had no such issue.)

PP PP P=padding area applied to left/right columns
+-----------------------+
| | : | |
| LEFT | CTR | RIGHT |
| COL | COL | COL |
| | : | |
| | : | |
| 1 | 2 | 3 |
| | : | |
+-----------------------+
:................. SEAM

In the end, I converted this easily to a table-based layout which
works fine. I wanted to avoid the table if only for better semantic
markup and faster display times on page loads.

Q1. Anyone ever created a three-column, pure CSS layout where the
center column is fixed and the left/right columns fluid (thus filling
100% of the browser width)? The edges of all columns must be
perfectly flush with each other.

I can see why so may web designers prefect fixed-width layouts.
They're far easier to control. Fluid layouts aren't bad so long as
every column spanning the page with has a percentage width. The real
issues that I had to design around involve the complexities with
combining indeterminate widths (based on percentages or ems) with
determinate ones (pixel based) and trying to get them to span 100% of
the width of any containing box. These things can be creatively
achieved, but because of browser discrepancies they can be harry.
Tables make achieving this simple. (When I set the table width to
100% and the center column to 230px, all browsers knew to distribute
the remaining width equally to the 2 remaining columns.) ...this is
just one situation where I found tables a blessing.

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?

I have some ideas myself, that could really make this easy.

Q3. Is there a suggestion box (email) to which I may send suggestions
to the W3C for consideration?

Mario T. Lanza
Clarity Information Architecture, Inc.
2004.09
  #2  
Old July 21st, 2005, 12:54 AM
Spartanicus
Guest
 
Posts: n/a
Default Re: CSS vs. Tables - When Tables win

mlanza@lycos.com (Mario T. Lanza) wrote:
[color=blue]
>Q1. Anyone ever created a three-column, pure CSS layout where the
>center column is fixed and the left/right columns fluid (thus filling
>100% of the browser width)? The edges of all columns must be
>perfectly flush with each other.[/color]

Easy with CSS 2.0, it's just that IE's CSS support is relatively poor
that's causing trouble.

Loads of 3 column CSS layout examples out there (including examples
hacked to work in IE), Google is your friend.

--
Spartanicus
  #3  
Old July 21st, 2005, 12:54 AM
Christoph Paeper
Guest
 
Posts: n/a
Default 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
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles