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 Creating a Horizontal Navigation with Floats

guram dgebuadze
seal-mask
.a{fill-rule:evenodd;}techdegree
guram dgebuadze
Front End Web Development Techdegree Student 4,122 Points

.clearfix::after{}

teacher uses only pseudo-class after, is it better to write this way .cf::before, .cf::after { content: " "; display: table; }

.cf::after { clear: both; }

3 Answers

Steven Parker
Steven Parker
229,732 Points

The dlearfix is only needed after the element that contains the floated items.

Besides, what would be the reason for adding a "before" pseudo element that does not include a "clear"?

Steven Parker
Steven Parker
229,732 Points

That article is about dealing with a problem in certain browsers, but it is 7 years old.

There's been a lot of improvement in browsers during that time, I suspect that information no longer applies to browsers in use today. The clearfix taught in the course is pretty much "standard practice" now.