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 trialguram 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
231,275 PointsThe 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"?
guram dgebuadze
Front End Web Development Techdegree Student 4,122 Pointsthere is written differently than what teacher said and that has confused me. http://nicolasgallagher.com/micro-clearfix-hack/
Steven Parker
231,275 PointsThat 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.
guram dgebuadze
Front End Web Development Techdegree Student 4,122 Pointsthank you, so much.