Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS

John Barhorst
John Barhorst
9,648 Points

Is this an updated version of the clear fix hack?

The original clear fix and the one they showed in the old CSS course was a bit more involved. I kind of fell off with my classes for about a year, and been coming back to get back on track. Is this shorter version in the video the standard way of doing it or a simplified version for the sake of the video?

The original one I have in my notes is:

Not sure how to get the character code in so my " " comes out as "".

.cf:before,
.cf:after {
  content: "";
  display: table;
}

.cf:after {
  clear: both;
}

.cf {
  * zoom: 1;    /** fixes rendering bug in IE7 & below **/
}

Hi John,

You didn't put the closing 3 backticks at the end of your css which caused the issue with the quotes.

1 Answer

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,623 Points

Hey John,

I've never seen the code you have posted. The clear-fix 'hack' I've seen around and in use is

.clearfix::after {  
  display: table; 
  content: ""; 
  clear: both; 
}

Reference from MDN

:)

John Barhorst
John Barhorst
9,648 Points

It's the first one that pops up when I google clearfix hack. http://nicolasgallagher.com/micro-clearfix-hack/

But if this much shorter one works just as well, then I'm all for it!

Thanks for the speedy reply.