What Are Other Ways to Do 2-Column Layouts?
I've been stuck with this approach for a 2-column site for quite a while now
- wrap elements in a "wrapper" div
- float main div to the left
- float sidebar to left
- apply clearfix on the wrapper div
the problem I am often having is that w开发者_C百科henever a non-floated element in the main div is alongside a floated one, I always have to do clears or clearfixes.
do you have any other approaches for 2-column layouts. by the way, I use the said approach in my blog:
I usually use a grid: http://www.1kbgrid.com/
It's more than just a 2-column layout, but I like the idea of it being flexible. For instance, it's really handy when you have some fancy layouts on the front page and fall back to your default 2-column on all the subpages. Saves a lot of time.
For the #wrapper
use overflow:auto
instead clear
.
Read more at http://www.quirksmode.org/css/clearing.html
I too used your method until i found Yahoos YUI, check it out!
精彩评论