Take the 2-minute tour ×

Is there any negative issue if we use overflow:hidden to clear float. is it cross browser compatible IE 6, 7 , firefox , safai etc.?

Is overflow:hidden enough or we need to add Zoom:1 too to make compatible with IE?

Is this way better than .clearfix to get cross browser compatibility?

share|improve this question
I've never liked overflow:hidden because it's not really how the spec intended overflow to be used. Maybe I'm just not practical enough. –  jtbandes Nov 19 '09 at 7:15
I'm fairly certain it's not IE 6 compatible, so if you require support for that browser it's off the table. –  jarcoal Nov 19 '09 at 7:39
@jtbandes then method would you prefer? –  Jitendra Vyas Nov 19 '09 at 7:40
I always use a clearfix like this: .clearfix { overflow: hidden; width: 100%; } and it works crossbrowser, never had a problem with it. –  meep Nov 19 '09 at 20:56
add comment

2 Answers

There is a pretty comprehensive list of float clearing techniques here:


I personally use the "float the parent" technique exclusively. It works in all commonly found browsers (IE6+, Firefox, Safari, etc.....), and it seems the "least dirty" of all the possible techniques.

Edit for comment:

This should work if I'm understanding you correctly:

#main {
     width: 900px;
     position: absolute;
     left: 50%;
     margin-left: -450px;

#col1, #col2, #col3 {
     float: left;
     width: 300px;

     <div id="main">
          <div id="col1"></div>
          <div id="col2"></div>
          <div id="col3"></div>
share|improve this answer
can u give me example on how to create 3 col fixed width centered layout with "float the parent" method –  Jitendra Vyas Nov 19 '09 at 18:12
I added an example. –  jarcoal Nov 19 '09 at 20:54
i didn't understood this part of #main {position: absolute;left:50%; margin-left: -450px;} –  Jitendra Vyas Nov 20 '09 at 3:23
That would center the layout. –  jarcoal Nov 20 '09 at 4:44
u mean {margin:0 auto} will not work if we use "Float the parent" method to build site –  Jitendra Vyas Nov 20 '09 at 5:13
show 1 more comment

it has worked fine for me across most browsers.

share|improve this answer
add comment

Your Answer


