<!doctype html>
<html>
<head>
<title>抬头</title>
<meta charset="utf-8">
<style>
.InternalStyle1
{
width:300px;
height:300px;
border: purple 30px solid;
background:green center bottom no-repeat url("dragon.png");
padding-top: 100px;
margin-bottom: 30px;//外边距
}
.InternalStyle2
{
width:300px;
height:300px;
border: brown 60px solid;
background:orange center bottom no-repeat url("dragon.png");
padding-top: 100px;
margin-top: 60px;//外边句会叠加,注意InternalStyle1与InternalStyle2放在一起时只有60px(最大)的边距,而不是相加后的90px
//margin:top right bottom left;//复合写法
//margin:top/bottom right/left;
}
</style>
<link href = "main.css" rel = "stylesheet">
</head>
<body>
<!属性:属性值(属性单位)>
<div style = "width:300px;height:100px;background:red">inline style1 行内样式1</div>
<div class = "InternalStyle1">Internal Style1 内部样式1</div>
<div class = "InternalStyle2">Internal Style2 内部样式2</div>
<div class = "ExternalStyle1">External Style1 外部样式1</div>
<div class = "InternalStyle2">
边距传递
<div class = "InternalStyle1">
边距传递:父子级包含时,子级的margin-top会传递给父级。
</div>
</div>
</body>
</html>