Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

CSS

Why is my clearfix not working?

.right::after{
    content: " ";
    display: table;
    clear: both;
}

I have 3 columns in my layout and I want the right column to always clear both floats. This is what I"m trying, but my page still isn't working correctly.

1 Answer

If you want to use a pseudo class for clearing, you'd want it :before, not :after since you're on the last element.

But couldn't you just use:

.right {
   clear:both;
}

I need the floats to be cleared after the .right column because I still need the .right column to be lined up with the .left and .mid columns. Clearing on the .right column causes the column to be on a separate row from the others.