In my search for answers, I have come across many general responses to this common question. However, none of them address the specific constraints that I am facing with this version.
The task at hand is to implement the holy grail layout, but with a key requirement: The columns must maintain their order from left to right, L (left), C (center), R (right), without relying on absolute positioning.
Another important consideration for me is browser compatibility. While I do not need to support outdated browsers like IE6, ensuring functionality for at least IE7 is preferable. Thus, using the calc()
CSS function is not an option.
The standard practice, as seen in the A List Apart article, involves arranging the columns in the order of C-L-R for SEO purposes. Many argue that this helps with search engine optimization and visual display. However, when it comes to accessibility tools like JAWS, the DOM order matters more.
Below is a typical markup structure for L-C-R:
<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>
Accompanying this structure is some CSS styling:
.wrapper {
width: 100%;
}
.container {
width: 90%;
margin-left: auto;
margin-right: auto;
}
.cell {
padding: 1em;
}
My goal is to fix the widths of .column-l
and
.column-r</code while keeping <code>.column-c
fluid. By floating .column-l
left and applying a margin left to .column-c
, these two columns fall into place as intended:
.column-l {
width: 300px;
float: left;
}
.column-c {
margin-left: 300px;
}
The issue arises with .column-r
. Despite attempting various adjustments, such as applying a float right or a margin-right property, it does not align correctly with the other columns. Even if a margin-right is given to .column-c
, .column-r
still refuses to cooperate.