Skip to content

Instantly share code, notes, and snippets.

@geddski
Created April 18, 2012 20:06
Show Gist options
  • Save geddski/2416187 to your computer and use it in GitHub Desktop.
Save geddski/2416187 to your computer and use it in GitHub Desktop.
micro clearfix LESS mixin
/* Micro ClearFix Mixin */
.clearfix{
zoom:1;
&:before, &:after{ content:""; display:table; }
&:after{ clear: both; }
}
Copy link

ghost commented Aug 19, 2014

Funny you mention that y0nas, in the face of * selectors in our contemporary Bootstrap epidemic. Yes - for anyone that finds this by random chance, don't go overboard. Creating anonymous table structure on every single element isn't exactly smart or fast.

@krismeister
Copy link

This is an old post, but its still ranked on google.

.my-class{
   &:extend(.clearfix all);
}

Will lead to less bloat. It hoists the .my-class selector upto the .clearless declaration.

@carbontwelve
Copy link

@krismeister thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment