2

In the premium templates on ThemeForest, I see that many templates adopt this method to clearfix:

.clearfix {
    height: 1%;
}

And add the class clearfix to various elements.

Why height 1%? Is a good way?

Keaire
  • 879
  • 1
  • 11
  • 30

2 Answers2

1

Your theme includes that class for compaitibility with Internet Explorer, which is a good thing.

https://css-tricks.com/snippets/css/clear-fix/

https://perishablepress.com/lessons-learned-concerning-the-clearfix-css-hack/

What methods of ‘clearfix’ can I use?

Community
  • 1
  • 1
jmargolisvt
  • 5,722
  • 4
  • 29
  • 46
1

Setting the height explicitly is the safest (read not the cleanest) way to clear floats. In the themes, the actual clearfix implementation would use :after pseudo selector to clear floats. However the :after property is not supported in IE6/7. Thus, height: 1% is specified. Which works in IE6/7.

Source http://www.pewpewlaser.com/articles/clearfix-ie

Rahul Nanwani
  • 1,267
  • 1
  • 10
  • 21