Am saying that the order of your could should GENERALLY reflect what you mean to say on the webpage. That means that WHENEVER POSSIBLE, whatever is most relevant/importatnt to the topic of that page should be higher up in the source code.
One thing that you must learn about web design is that each case is different , change one thing , and all of your strategy will needs to be reconsidered. So not so much rules as guides and best practices.
What you lose by floating all columns:
- auto width, as floated columns shrink-wrap to the size of their content, so a width needs to be given.
What you gain:
- extra layout flexibility. This is what i was trying to explaing earlier, but it takes some understanding of the nuances of floats.
Consider this:
if you float:left 3 elements this wild will happen:
ELEMNT1.ELEMNT2.ELEMNT3so the second element is displayed to the RIGHT of the first element, and the third is displayed to the right of of the second… see the flow happing there. When you float:right the flow is reversed the first element is on the right , the next is to the LEFT of that , and so forth. (you do have to keep in mind what I said earlier about floating elements NOT being able to be displayed any higher than anything that PRECEDES them in the SOURCE code.
Some practical examples:
THE MARKUP ( not we don’t change this much or at all, seven when we alter the order of display)
<div class="wrap">
<div class="main">Main content</div>
<div class="sec">secondary stuff</div>
<div class="ter">assides and aditions</div>
</div>
THE GENERAL CSS
.wrap{
overflow:hidden; /* conatins float*/
max-width:960px;
background:pink;
margin:0 auto; /* centers it*/
}
.main {
width:60%;
background:red;
}
.sec {
width:25%;
background:cyan;
}
.ter {
width:15%;
background:yellow;
}
.main , .sec, .ter{
float:left;
}
NOW THE MAGIC:
let say we want our secondary content on the left, our main in the middle , and our tertiary on the right, just add this CSS :
.main {
margin-left:25%;/* malkes space for the left column*/
}
.sec {
margin-left:-85%;/* the sum of its width PLUS the center column*/
}
but if we let say we want our secondary content on the right, our main in the middle , and our tertiary on the left, just add this instead :
.main {margin-left:15%;/* malkes space for the left column*/
}
.sec {float:right;/* moves the sec to the right most*/
}
.ter {margin-left:-75%; /* the sum of its width PLUS the center column*/
}
change your mind, and want the terciary content on the middle, the sec in the middle and the main on the left?
.sec {float:right;/* moves the sec to the right most*/
}
by now you can see how powerful this could be!
as far as adding columns, that really depends… but one way is to sub wrap column groups ( so for example main and sec wrapped in a group div and treated as ‘main’) and apply the same techniques as above
I hope that helps.