IE6下position:absolute定位错误的bug和解决方法

今天在项目中碰到了一个位置:

例:如下

<div style="position:relative;">
    <div style="text-align:center;"><span style="display:inline-block;height:24px;text-align:center;80px;background:red;"></span>(只要这里面有内容)</div>
    <div style="80px;height:24px;position:absolute;top:0;left:0px;background:green;"></div>
</div>

其它浏览器表现正常,第二个DIV在父元素的左边对齐,其在IE6中会以第一个子DIV元素为参考点,表现与其它的浏览器不一致

经过研究才知道是IE6的问题,解决办法是触发IE6的layout,给父元素加个100%或zoom:1来解决

原文地址:https://www.cnblogs.com/xiaohui108/p/2318098.html