css 例子
This commit is contained in:
42
csspress/demo/margin2.html
Normal file
42
csspress/demo/margin2.html
Normal file
@@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<style>
|
||||
.box{
|
||||
width:1000px;
|
||||
height:300px;
|
||||
background: gold;
|
||||
}
|
||||
.box1{
|
||||
width:50px;
|
||||
height: 50px;
|
||||
background:red;
|
||||
margin-bottom: 50px;
|
||||
}
|
||||
.box2{
|
||||
width:50px;
|
||||
height:50px;
|
||||
background: blue;
|
||||
margin-top: 100px;
|
||||
}
|
||||
.box3{
|
||||
background:pink;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="box1">中国</div>
|
||||
<div class="box2">美国</div>
|
||||
|
||||
<p>
|
||||
总结:当给中国加下边距(100px)和给美国(50)加上边距的时候 ,会发生外边距合并的现象
|
||||
即 中国和美国的外边距等于中国和美国的外边距中较大的那个值 此例中 中美外边距为100px
|
||||
</p>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user