I’ve re-coded the CSS to allow a three column website design.
All visually looks well so far but as it stands I’m having to render the columns in the following order:
left column
right column
center column
Naturally this isn’t best for SEO as the vast chunk of the content found in the center column is last. If the left and right columns have a lot of content of their own there’s a risk the SERP’s won’t spider all the way down in the code to read the center column content.
If I reorder it so the center column gets rendered first followed by the left and finally right column, the design loses integrity.
Any ideas how I can force this to work correctly in all major browsers?
I got it to work well despite the width’s not adding up to 1144px which is the global container width. 200 + 584 + 180 != 1144 (964). Either the padding does the rest (haven’t added it up) or there’s some overlapping going on. At any rate I’ve tested it in IE8, FF 3.6, Opera 10.2, Chrome 5 and all looks good. Of course IE6 has a mind of it’s own adding extra padding thus corrupting the layout. I think I’ll just warn visitors with a popup or something to stop using IE6.
left-body needs the margin in there as otherwise any images that touch the left or right side of that column don’t align up well (small vertical gap). Maybe some tweaking with the padding can override this though last time I tried it wouldn’t work.
I thought your margins and padding were a little overdriven or overcomplicated. I’m not sure what they’re being used for. You’ll need to be very careful adding up all the margins and padding of the inner elements. Add ugly background colours while playing around with this and/or use a tool like Firebug or Dragonfly to make sure everyone fits.
What you wrote makes a lot of sense and should work like a charm. Thanks.
Given that the margins are setup in the global container which would house the <main> container I assume <main> can be very basic as below and still work? …or is there anything I need to look out for to force browser compatibility?
#main {
width: 778px; (width of left + center column combined)
overflow: hidden;
}
The margins and padding are there because of how IE6 needed them to render the page correctly.
I’ve generally never gone that far for IE6, so I believe it’s very possible to simplify your code.
You have a full, complete, valid doctype? No comments or anything before the doctype to trigger quirks mode?
When floating boxes, there are some known bugs: 3px jog hits you when you have a float next to a non-float. 50% + 50% = 101% is another known bug.
If you get IE6 dropping a float when mathematically everything should fit, you could use any of the solutions Paul O’B posted in the Floats Sticky.
#element {
normal code;
}
html #element {margin-right: -6px;}
that kind of thing. Generally you should only need to do it once for a major layout like this.
Also keep an eye out for the double-margin float bug, but you’ve surely heard of it. If not, it’s in the thread linked above.
I hate math so personally I try to keep my margins/padding pretty simple whenever possible. : ) If a box doesn’t have any borders or background colours, padding and margin look identical, so I try to only use one (usually margin).
<body>
<main><– this is floated left and is as wide as center + left
<center-body/><– this one is floated right
<left-body/> <– this one is floated left
</main>
<right-body><–floated right
</body>
I dunno what you are able to do HTML-wise, but adding a container can make it easy for you to keep content-first.