-
Notifications
You must be signed in to change notification settings - Fork 0
/
响应式布局.html
93 lines (93 loc) · 2.18 KB
/
响应式布局.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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>响应式布局</title>
<style>
*{
padding: 0;
margin: 0;
list-style: none;
}
.header{
height: auto;
background: #6eb49c;
overflow: hidden;
padding: 20px;
margin: 20px auto;
box-sizing: border-box;
}
/*属性选择器的样式应用*/
div[active]{
height: 100px;
width: auto;
float: left;
}
@media screen and (max-width: 680px){
.header{
background: #9f683b;
width: 500px;
}
div[active]{
width: 100%;
}
}
@media screen and (min-width: 680px){
.header{
background: #9f6593;
width: 700px;
}
div[active]{
width: 50%;
}
}
/*3*/
@media screen and (min-width: 768px){
.header{
background: #289f52;
width: 800px;
}
div[active]{
width: 33.333333%;
}
}
/*4*/
@media screen and (min-width: 992px){
.header{
background: #ac3f9a;
width: 1000px;
}
div[active]{
width: 25%;
}
}
/*6*/
@media screen and (min-width: 1200px){
.header{
background: #2c5160;
width: 1200px;
}
div[active]{
width: 16.666666%;
}
}
</style>
</head>
<body>
<div class="header">
<!-- 属性选择器-->
<div active="true">1</div>
<div active="true">2</div>
<div active="true">3</div>
<div active="true">4</div>
<div active="true">5</div>
<div active="true">6</div>
<div active="true">7</div>
<div active="true">8</div>
<div active="true">9</div>
<div active="true">10</div>
<div active="true">11</div>
<div active="true">12</div>
</div>
</body>
</html>