css 例子
This commit is contained in:
45
csspress/demo/margin.html
Normal file
45
csspress/demo/margin.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<!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;
|
||||
}
|
||||
.box2{
|
||||
/* width:80px; */
|
||||
height:50px;
|
||||
background: blue;
|
||||
margin-left: 20px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
.box3{
|
||||
background:pink;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="box1">aaa</div>
|
||||
<div class="box2">bbb</div>
|
||||
|
||||
<p>
|
||||
总结margin 一个值得时候定义的是上下左右四个方向的边距
|
||||
<p>两个值得时候定义的前一个值是上下的边距 后面的值是左右的边距</p>
|
||||
<p>三个值得时候第一个值是上边距 第二个值是左右边距 第三个值是下边距</p>
|
||||
<p>四个值得时候是上右下左的边距</p>
|
||||
|
||||
|
||||
|
||||
</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user