码迷,mamicode.com
首页 > 其他好文 > 详细

兼容性—IE6定位

时间:2017-05-14 19:44:06      阅读:182      评论:0      收藏:0      [点我收藏+]

标签:ott   ima   title   color   pre   meta   set   解决方案   .com   

父级元素宽高为奇数时,绝对定位的right和bottom会有1px的偏差

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        .box{
            width: 401px;
            height: 401px;
            background: red;
            position: relative;
        }
        .content{
            width: 200px;
            height: 200px;
            background: blue;
            position: absolute;
            right: 0;
            bottom: 0;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="content"></div>
    </div>
</body>
</html>

IE6显示效果如下:

技术分享

解决方案:避免设置父级元素的宽高为奇数

兼容性—IE6定位

标签:ott   ima   title   color   pre   meta   set   解决方案   .com   

原文地址:http://www.cnblogs.com/halai/p/6853306.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!