Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Align two columns next to each other without removing them from their container?

Align two columns next to each other without removing them from their container?

Problem

In the above example I can't seem to get content and sidebar to show up next to each other without using Floats. Using floats works but it removes them from the bounds of the content class.

Problem courtesy of: Renari

Solution

If I got your question right, the problem is not the float itstelf, but the missing clearing of the floats.

You can use floats and just add a clearfix to your .container class:

.container:after {
    content: ".";
    display: block;
    clear: both;
    visibility: hidden;
    line-height: 0;
    height: 0;
}

This acts the same way as adding

at the bottom html of .container

Solution courtesy of: Kilian Stinson

Discussion

View additional discussion.



This post first appeared on CSS3 Recipes - The Solution To All Your Style Problems, please read the originial post: here

Share the post

Align two columns next to each other without removing them from their container?

×

Subscribe to Css3 Recipes - The Solution To All Your Style Problems

Get updates delivered right to your inbox!

Thank you for your subscription

×