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 Clearing and Containing Floats

Clear fix is not working

Can you help me solve the problem please? Im doing everything fine but the header is still not covering up the nav bar :/ My code: .clearfix::after{ content: ""; display:table; clear:both; }

Steven Parker
Steven Parker
229,608 Points

That's not enough of the code to demonstrate the issue. To facilitate a complete analysis, make a snapshot of your workspace and post the link to it here.

4 Answers

Adam Vala
Adam Vala
9,300 Points

I had the same problem. I had a space after the two colons in .clearfix::after.

And in the case of OP, I think he didn't add clearfix class in HTML.

And yes please do check out the teachers note always. They could be sometimes more beneficial than the video. I said "Sometimes". XXOXOX

Ethan Zoller
Ethan Zoller
7,592 Points

Make sure you are adding the class clearfix inside your html.

Brittney Laffey
Brittney Laffey
14,740 Points

Your code shows 2 colons after ".clearfix". Try deleting one.

Steven Parker
Steven Parker
229,608 Points

:information_source: Two colons is the correct syntax for a pseudo-element, though most browsers will let you get away with just one.