-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
160 lines (139 loc) · 4.22 KB
/
index.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>Holy Grail</title>
<style>
/* some basic styles. nothing to do with flexbox */
header, footer,
nav, article, aside {
border: 1px solid black;
padding: 0.25em;
margin: 0.25em;
border-radius: 0.25em;
}
/*
Force full width & height.
If this block is removed, the layout height/length will be determined by
the amount of content in the page. That might result in a page which has
a footer only a few inches from the top of the viewport, or one which
scrolls beyond the viewport.
This forces the layout to always be full screen regardless of how much,
or how little, content is in place. Neither is "right" or "wrong", there
are valid cases for each. I just want to be clear what's controlling the
page/viewport height.
*/
html, body, .viewport {
width: 100%;
height: 100%;
margin: 0;
}
/* encapsulate the various syntax in helper clases */
/* inspired by http://infrequently.org/2009/08/css-3-progress/ */
/* items flex/expand vertically */
.vbox {
/* previous syntax */
display: -webkit-box;
display: -moz-box;
display: box;
-webkit-box-orient: vertical;
-moz-box-orient: vertical;
-ms-box-orient: vertical;
box-orient: vertical;
/* current syntax */
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: flex;
-webkit-flex-direction: column;
-moz-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
/* items flex/expand horizontally */
.hbox {
/* previous syntax */
display: -webkit-box;
display: -moz-box;
display: -ms-box;
display: box;
-webkit-box-orient: horizontal;
-moz-box-orient: horizontal;
-ms-box-orient: horizontal;
box-orient: horizontal;
/* current syntax */
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: flex;
-webkit-flex-direction: row;
-moz-flex-direction: row;
-ms-flex-direction: row;
flex-direction: row;
}
.space-between {
/* previous syntax */
-webkit-box-pack: justify;
-moz-box-pack: justify;
-ms-box-pack: justify;
box-pack: justify;
/* current syntax */
-webkit-justify-content: space-between;
-moz-justify-content: space-between;
-ms-justify-content: space-between;
justify-content: space-between;
}
/* I went with a fixed height header & footer because it's a common case.
This could easily be altered to flex proportionally with the page.
*/
header, footer {
height: 100px;
}
.main {
/* previous syntax */
-webkit-box-flex: 1;
-moz-box-flex: 1;
-ms-box-flex: 1;
box-flex: 1;
/* current syntax */
-webkit-flex: 1;
-moz-flex: 1;
-ms-flex: 1;
flex: 1;
}
article {
/* previous syntax */
-webkit-box-flex: 5;
-moz-box-flex: 5;
-ms-box-flex: 5;
box-flex: 5;
/* current syntax */
-webkit-flex: 5;
-moz-flex: 5;
-ms-flex: 5;
flex: 5;
}
aside, nav {
/* previous syntax */
-webkit-box-flex: 1;
-moz-box-flex: 1;
-ms-box-flex: 1;
box-flex: 1;
/* current syntax */
-webkit-flex: 1;
-moz-flex: 1;
-ms-flex: 1;
flex: 1;
}
</style>
</head>
<body class="vbox viewport">
<header>Header</header>
<section class="main hbox space-between">
<nav>Nav</nav>
<article>Article</article>
<aside>Aside</aside>
</section>
<footer>Footer</footer>
</body>
</html>