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!