-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
101 lines (100 loc) · 2.13 KB
/
Copy pathtest.html
File metadata and controls
101 lines (100 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
<style>
.outer{
background-color:blue;
height:300px; width:300px;
line-height:300px;
}
.inner{
background-color:green;
display:inline-block;
vertical-align:middle;
height:150px;width:150px;
}
.parent{
box-sizing:border-box;
width:300px;
height:50px;
background-color:green;
}
.children{
box-sizing:border-box;
width:100%;margin-left:30px;margin-right:20px;
height:30px;background-color:blue;
}
.parent1{
/*box-sizing:border-box;*/
border:1px solid green;
padding:20px;
width:300px;height:300px;
}
.children1{
/*box-sizing:border-box;*/
padding:20px;
width:100%;
width:auto;
background-color:blue;
height:100px;
}
.parent2{
box-sizing:border-box;
border:10px dotted green;
/*padding:20px;*/
width:300px;height:300px;
}
.children2{
box-sizing:border-box;
width:100%;
background-color:blue;
height:100px;
}
.container{
background-color:#cac;
margin-top:-30px;
height:40px;
}
.container p{
/*box-sizing:border-box;*/
margin:0;padding:0;
height:40px;width:50px;
float:left;
background-color:yellow;
border:1px solid #ddd;
}
.container p:nth-child(3){
background-color:blue;
margin-top:-15px;
}
</style>
</head>
<body>
<div class='outer'>
<div class="inner"></div>
</div>
<hr/>
<h3>width100%加上margin的情况</h3>
<div class="parent">
<div class="children"></div>
</div>
<hr/>
<div class="parent1">
<div class="children1"></div>
</div>
<div class="parent2">
<div class="children2"></div>
</div>
<hr/>
<h3>使用margin负值后是否还占据原来的空间</h3>
<li><img src="src/imgs/banner_1.png" alt=""/></li>
<div class="container">
<p class='first'></p>
<p class='second'></p>
<p class='third'></p>
</div>
<div class='test' style='background-color:#afa;height:40px;'></div>
</body>
</html>