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

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,859 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.