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 CSS Layout Basics Page Layout with the Float Property The Float Challenge Solution

Austin Adams
Austin Adams
7,060 Points

My footer collapsed and is ignoring the body. What container do I need to Clearfix?

I;m trying to get my layout working, but I added floats to my paragraph elements to make a two column layout. This jumped my footer flush with the bottom of my main header. I have tried adding clear fix to a couple of different elements but nothing is fixing the problem.

2 Answers

Ally W.
Ally W.
8,213 Points

You should add clearfix to the parent of the floated elements using ::after, like so:

parent::after { content: ' '; display: block; clear: both; }

or if you have:

clearfix::after { content: ' '; display: block; clear: both; }

in your css code, just add the class clearfix to the parent element.

Austin Adams
Austin Adams
7,060 Points

Thank you for your help!