-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path外间距和内间距.html
More file actions
44 lines (35 loc) · 1.09 KB
/
Copy path外间距和内间距.html
File metadata and controls
44 lines (35 loc) · 1.09 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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.item {
display: inline-block;
background-color: brown;
/* margin:外间距,表示元素距离相邻的元素或父元素边界的距离。 */
/* margin可以设置1个值,2个值,4个值,1个值表示4边的,2个值表示上下的和左右的,4个值表示上右下左 */
margin: 30px;
/* 也可以单独设置某一边的外间距 */
margin-top: 10px;
}
#d1 {
width: 100px;
height: 100px;
border: solid 1px black;
/* padding,内间距,表示元素内容和元素边框之间的距离 */
padding: 10px;
background-color: aqua;
/* background-clip: content-box; */
}
</style>
</head>
<body>
<span class="item">首页</span>
<span class="item">新闻</span>
<span class="item">图片</span>
<div id="d1">内间距,表示元素内容和元素边框的距离</div>
</body>
</html>