-
Notifications
You must be signed in to change notification settings - Fork 3
/
grid-2.html
80 lines (74 loc) · 1.86 KB
/
grid-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
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>2 columns, 3 rows</title>
<link rel="stylesheet" href="css/stylesheet.css" />
<style type="text/css">
body {
display: grid;
grid-gap: 2vw;
grid-template-areas:
"header"
"article"
"sidebar"
"footer";
grid-template-columns: 1fr;
grid-template-rows: auto;
margin: 1vw;
color: var(--ucla-black-80);
}
@media (min-width: 30em) {
body {
display: grid;
grid-column-gap: 4vw;
grid-template-areas:
"header header header"
"sidebar photo article"
"footer footer footer";
grid-template-columns: 2fr 4fr 1fr;
grid-template-rows: auto;
margin: 1vw;
}
}
body > * {
border-radius: 5px;
padding: 1em;
}
header {
background-color: var(--ucla-lighter-blue);
grid-area: header;
}
aside {
background-color: var(--ucla-gold);
grid-area: sidebar;
}
article {
background-color: var(--ucla-black-10);
grid-area: article;
}
img {
grid-area: photo;
}
footer {
background-color: hotpink;
grid-area: footer;
}
</style>
</head>
<body>
<header>Page Header</header>
<img src="img/neven-krcmarek-175845-unsplash-1.jpg">
<aside>Sidebar</aside>
<article>
<h1>2 columns, 3 rows</h1>
<p><strong>header, article, sidebar and footer</strong></p>
<p>
This example uses line-based positioning, to position the header and
footer, stretching them across the grid.
</p>
</article>
<footer>Page Footer</footer>
</body>
</html>