-
Notifications
You must be signed in to change notification settings - Fork 5
/
flexbox.html
141 lines (141 loc) · 3.19 KB
/
flexbox.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Flexbox</title>
<style>
html {
box-sizing: border-box;
}
*,
*:before,
*:after {
box-sizing: inherit;
}
html,
body {
height: 100%;
}
body {
margin: 0;
-webkit-text-size-adjust: 100%;
font-size: 1rem;
font-weight: 400;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
"Helvetica Neue", Arial, sans-serif;
background-color: #fafafa;
line-height: 1.5;
/* let's flex */
display: flex;
flex-direction: column;
}
/* CHANGE THIS */
header {
background-color: rgba(250, 0, 0, 0.2);
}
nav {
background-color: rgba(250, 0, 0, 0.2);
padding: 1rem;
display: flex;
justify-content: space-between;
align-items: center;
}
nav ul {
display: flex;
margin: 0;
padding: 0;
}
nav ul li {
list-style: none;
margin-left: 0.5rem;
}
h1 {
text-align: center;
padding: 0.5rem;
margin: 0;
}
main {
display: flex;
flex-direction: column;
flex: 1 1 auto;
}
aside {
flex: 0 0 25%;
background-color: rgba(0, 250, 0, 0.2);
flex-direction: column;
display: none;
}
aside > div {
padding: 1rem;
}
.center {
display: flex;
justify-content: center;
align-items: center;
flex: 1 1 auto;
}
.centered {
padding: 0.25rem 0.5rem;
background-color: rgba(0, 250, 0, 0.2);
}
section {
flex: 1 1 auto;
padding: 0.5rem;
background-color: rgba(0, 0, 250, 0.2);
}
.side {
flex: 0 0 20%;
padding: 0.5rem;
background-color: rgba(0, 250, 250, 0.1);
}
.item {
padding: 1rem;
margin-bottom: 0.5rem;
background-color: rgba(0, 250, 200, 0.2);
}
footer {
background-color: rgba(250, 100, 0, 0.2);
text-align: center;
padding: 1rem;
}
@media screen and (min-width: 480px) {
main {
flex-direction: row;
}
aside {
display: flex;
}
}
</style>
</head>
<body>
<header>
<nav>
<div>logo</div>
<ul>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
<li><a href="#">link</a></li>
</ul>
</nav>
<h1>title</h1>
</header>
<main>
<aside>
<div>top</div>
<div class="center"><div class="centered">middle</div></div>
<div>bottom</div>
</aside>
<section>section</section>
<div class="side">
<div class="item">item</div>
<div class="item">item</div>
<div class="item">item</div>
</div>
</main>
<footer>footer</footer>
</body>
</html>