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

兼容性—margin

时间:2017-05-12 17:31:16      阅读:195      评论:0      收藏:0      [点我收藏+]

标签:显示效果   兼容性   jpg   color   blog   .com   margin   image   oct   

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        .box{
            background: blue;
        }
        .content{
            height: 40px;
            background: red;
            margin: 50px;
        }
    </style>
</head>
<body>
    <div class="box">
        <div class="content"></div>
        <div class="content"></div>
    </div>
</body>
</html>

所有浏览器显示效果都一样

技术分享

给父级加上border属性,除IE6/7以外都可正常显示,可以通过overflow和zoom触发BFC和layout属性解决

.box{
            background: blue;
            overflow: hidden;
            zoom: 1;
}

 

兼容性—margin

标签:显示效果   兼容性   jpg   color   blog   .com   margin   image   oct   

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

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