margin叠加相邻两个元素的上下margin是叠加在一起

 1

<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<style>
#box{width:200px;height:200px;background:Red;border:10px solid #000; margin:30px 100px 100px}
#div{width:200px;height:200px;background:blue;border:10px solid #ccc; margin:40px;}
/*
margin 外边距(margin元素的边框之外不显示元素背景)
margin:10px 20px;上 左
margin:10px 20px 40px;上 左下
margin:10px 20px 40px 60px;上 右 下 左
margin-top
margin-right
margin-bottom
margin-left

margin叠加相邻两个元素的上下margin是叠加在一起
*/
</style>
</head>
<body>
<div id="box"></div>
<div id="div"></div>
</body>
</html>


 

posted on 2016-02-28 20:21  hduhdc  阅读(536)  评论(0编辑  收藏  举报