-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdemo3-1-answer.html
124 lines (110 loc) · 2.65 KB
/
demo3-1-answer.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>demo3-1</title>
<style>
* {
box-sizing: border-box;
}
html {
font-size: 16px;
}
body {
margin: 0;
}
</style>
</head>
<!-- 不能改动 HTML 结构 -->
<body>
<div class="header">Header</div>
<div class="content">
<div class="card card1">small (≥ 640px)</div>
<div class="card card2">medium (≥ 768px)</div>
<div class="card card3">large (≥ 1024px)</div>
<div class="card card4">xlarge (≥ 1280px)</div>
<div class="card card5">2xl (≥ 1536px)</div>
<div>
<p>作业要求:</p>
<ol>
<li>
为 content 设置合理的 padding,使其可显示范围恰好为屏幕上除 header
外的所有区域(即使页面的显示区域刚好覆盖整个屏幕但是不出现滚动条),并将背景颜色设置为
#f0f8ff。
</li>
<li>
利用 CSS Media Query 为下面的 card1、card2、card3、card4、card5
设置合适的 display 属性,使其在不同屏幕尺寸下显示。
</li>
<li>
将本列表的第二个条目设置为红色,但不使用 class 和 id
选择器(即基于现有的 HTML 结构编写选择器)。
</li>
<li>
将本列表中的所有奇数条目设置为粗体,但不使用 class 和 id
选择器(即基于现有的 HTML 结构编写选择器)。
</li>
</ol>
</div>
</div>
</body>
<style>
.header {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 50px;
padding: 10px 15px;
background-color: #ccc;
}
.card {
display: none;
width: 200px;
height: 50px;
border: 1px solid #ccc;
}
/* 以上代码请勿修改 */
/* 请在下方完成你的代码 */
/* 1 */
.content {
height: 100vh;
padding-top: 50px;
background-color: #f0f8ff;
}
/* 2 */
@media (min-width: 640px) {
.card1 {
display: block;
}
}
@media (min-width: 768px) {
.card2 {
display: block;
}
}
@media (min-width: 1024px) {
.card3 {
display: block;
}
}
@media (min-width: 1280px) {
.card4 {
display: block;
}
}
@media (min-width: 1536px) {
.card5 {
display: block;
}
}
/* 3 */
li:nth-child(2) {
color: red;
}
/* 4 */
li:nth-child(odd) {
font-weight: bold;
}
</style>
</html>