<style type="text/css">
.first,.second,p{background:pink;}
</style>
</head>
<body>
<div class="first">div1</div>
<div class="second">div2</div>
<p>段落1段落1段落1段落1段落1</p>
</body>
为什么即使这样也不能把两个div的背景像div与p之间一样隔开?
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>内联块状元素</title>
<style type="text/css">
div,p{background:pink;margin-top:30px;
}
</style>
</head>
<body>
<div>div1</div>
<div>div2</div>
<p>段落1段落1段落1段落1段落1</p>
</body>
</html>
div要设置margin属性,margin控制相邻div之间的距离,分别有上右下左四个方向