While this question in general is quite common, I haven't found an answer addressing the specific constraints in this version.
I'm looking to implement the holy grail, with one important caveat: The columns must remain in order from left to right, L (left), C (center), R (right), without the use of absolute positioning.
In addition to the above major requirements, compatibility is pretty high on the list; mind you, I'm not trying to support anything ridiculous like IE6; at least IE7 would be preferable. (yes, I think it's ridiculous these days) Given this, the immediately obvious calc()
CSS function is not applicable.
In the linked article, A List Apart has implemented this as C-L-R, citing "proper source order", and many have followed this trend arguing benefits of SEO as the main page content appears first in the source order. Also, it works, visually.
Unfortunately, SEO and accessibility are two different beasts. It has been brought to my attention that the majority of web accessibility tools (JAWS, for instance) will understandably read the page content in DOM order; top-down, left-to-right.
Here's some fairly standard L-C-R markup:
<div class="wrapper">
<div class="container">
<div class="column-l">
<div class="cell">Column L</div>
</div>
<div class="column-c">
<div class="cell">Column C</div>
</div>
<div class="column-r">
<div class="cell">Column R</div>
</div>
</div>
</div>
And a snippet of CSS to go with it:
.wrapper {
width: 100%;
}
.container {
width: 90%;
margin-left: auto;
margin-right: auto;
}
.cell {
padding: 1em;
}
Given the full width .wrapper
and the 90%-width margin-centered .container
, I'm trying to display .column-l
, and .column-r
as fixed width (say 300px), with .column-c
as fluid.
By giving .column-l
a float: left;
property, and applying a margin-left
of 300px
to .column-c
, those two columns fall into place:
.column-l {
width: 300px;
float: left;
}
.column-c {
margin-left: 300px;
}
The problem is .column-r
. It doesn't want to sit where I want it to. Applying a float: right;
to .column-r
places it under the other two (mind you, at least it's at the right). This is true even if I apply a margin-right: 300px;
to the .column-c
.