Skip to content

Commit 0f01149

Browse files
committed
add html task8
1 parent 73c0fd9 commit 0f01149

File tree

2 files changed

+67
-0
lines changed

2 files changed

+67
-0
lines changed

HTML-CSS/task8/css/style.css

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
* { margin: 0;padding: 0;box-sizing: border-box; }
2+
3+
.container { width: 100%; padding: 10px; }
4+
.row { width: 100%; }
5+
.row::after,
6+
.row::before { content: ''; display: block; clear: both; }
7+
[class*="col-"] { padding: 10px;float: left; }
8+
@media all and ( min-width: 768px ) {
9+
.col-md-1 { width: 8.333%; }
10+
.col-md-2 { width: 16.666%; }
11+
.col-md-3 { width: 25%; }
12+
.col-md-4 { width: 33.333%; }
13+
.col-md-5 { width: 41.666%; }
14+
.col-md-6 { width: 50%; }
15+
.col-md-7 { width: 58.333%; }
16+
.col-md-8 { width: 66.666%; }
17+
.col-md-9 { width: 75%; }
18+
.col-md-10 { width: 83.333%; }
19+
.col-md-11 { width: 91.666%; }
20+
.col-md-12 { width: 100%; }
21+
}
22+
@media all and ( max-width: 768px ) {
23+
.col-sm-1 { width: 8.333%; }
24+
.col-sm-2 { width: 16.666%; }
25+
.col-sm-3 { width: 25%; }
26+
.col-sm-4 { width: 33.333%; }
27+
.col-sm-5 { width: 41.666%; }
28+
.col-sm-6 { width: 50%; }
29+
.col-sm-7 { width: 58.333%; }
30+
.col-sm-8 { width: 66.666%; }
31+
.col-sm-9 { width: 75%; }
32+
.col-sm-10 { width: 83.333%; }
33+
.col-sm-11 { width: 91.666%; }
34+
.col-sm-12 { width: 100%; }
35+
}
36+
37+
38+
39+
[class*='col-'] > div {
40+
width: 100%;
41+
height: 50px;
42+
border: 1px solid #999;
43+
background-color: #eee;
44+
}

HTML-CSS/task8/index.html

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>响应式网格(栅格化)布局</title>
6+
<link rel="stylesheet" href="css/style.css">
7+
</head>
8+
<body>
9+
<div class="container row">
10+
<div class="col-md-4 col-sm-6"><div></div></div>
11+
<div class="col-md-4 col-sm-6"><div></div></div>
12+
<div class="col-md-4 col-sm-12"><div></div></div>
13+
<div class="col-md-3 col-sm-3"><div></div></div>
14+
<div class="col-md-6 col-sm-6"><div></div></div>
15+
<div class="col-md-3 col-sm-3"><div></div></div>
16+
<div class="col-md-1 col-sm-2"><div></div></div>
17+
<div class="col-md-1 col-sm-2"><div></div></div>
18+
<div class="col-md-2 col-sm-8"><div></div></div>
19+
<div class="col-md-2 col-sm-3"><div></div></div>
20+
<div class="col-md-6 col-sm-3"><div></div></div>
21+
</div>
22+
</body>
23+
</html>

0 commit comments

Comments
 (0)