<!DOCTYPE html>
<html lang="en">
<head>
<style>
*{
margin: 0;
padding: 0;
}
.wrapper{
height: 200px;
width: 200px;
background-color: black;
margin-left: 50px;
margin-top: 50px;
/*在父级加个顶,设置上边框,然后颜色设置为透明transparent,嘿嘿*/
/*这样确实能达到目的,但是差1像素,还是不合格*/
/*border-top: 1px solid red;*/
}
.content{
width: 100px;
height: 100px;
background-color: green;
margin-left: 20px;
/*问题出现这这里*/
margin-top: 20px;
/*只有 margin-top 的值大于父级的 margin-top 的值时才有效*/
/*并且会带着父级一起向下*/
/*margin-top: 120px;*/
/*margin-top: 300px;*/
/*margin 没有“顶”*/
/*那就在父级加个顶???设置上边框,然后颜色设置为透明transparent,嘿嘿*/
/*这个也无效*/
/*margin-bottom: 10px;*/
}
</style>
<meta charset="UTF-8">
<title>bug--margin塌陷</title>
</head>
<body>
<div class="wrapper">
<div class="content"></div>
</div>
</body>
</html>
bug--margin塌陷
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
推荐阅读更多精彩内容
- app测试时怎样避免没有测试完善出现的bug,比如说在6上运行没事在4上运行就出bug了。(胡忠应) 提示:1.项...
- 已64位VMware Workstation Pro12为例 安装64位linux是报错 系统弹出64为报错是因为...