Is there any negative issue if we use overflow:hidden
to clear float. is it cross b开发者_高级运维rowser 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?
There is a pretty comprehensive list of float clearing techniques here:
How do you keep parents of floated elements from collapsing?
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;
}
<body>
<div id="main">
<div id="col1"></div>
<div id="col2"></div>
<div id="col3"></div>
</div>
</body>
精彩评论