webveuje/csspress/demo/margin2.html
2021-01-18 18:11:23 +08:00

42 lines
1.0 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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>