-
Notifications
You must be signed in to change notification settings - Fork 28
/
3-2.html
48 lines (44 loc) · 1.17 KB
/
3-2.html
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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>法2:元素宽度未知,且所有元素都在一个容器</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
.wrapper {
width: 391px;
padding: 10px;
margin: 150px auto;
border: 2px solid rgb(240, 103, 103);
}
.container {
display: flex;
flex-wrap: wrap;
margin-bottom: -20px;
margin-right: -30px;
}
.item {
margin-right: 30px;
margin-bottom: 20px;
padding: 5px 10px;
font-size: 20px;
border-radius: 5px / 5px;
background: rgb(103, 164, 243);
}
</style>
</head>
<body>
<div class="wrapper">
<div class='container'>
<div class='item'>两个才能成一行呀</div>
<div class='item'>两个才能成一行呀</div>
<div class='item'>这三个字</div>
<div class='item'>四个</div>
<div class='item'>独成一行呀独成一行呀独成一行呀独成</div>
<div class='item'>两个才能成一行呀</div>
<div class='item'>四个</div>
</div>
</div>
</body>
</html>