-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlayout.css
More file actions
216 lines (177 loc) · 4.31 KB
/
layout.css
File metadata and controls
216 lines (177 loc) · 4.31 KB
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
/*
PAGE SETUP
----------
/*
The app container takes the full height of the browser window.
(100vh = 100% of the viewport's height).
You can also use the `min-height` property instead
if you want to ensure the app is at least
as big as the browser window, but not constrain it beyond that.
*/
/*
FLEXBOX LAYOUT
--------------
We're using the BEM naming methodology (http://getbem.com/naming/).
Block:
.layout
Elements:
.layout__item
Modifiers:
.layout__item--fixed-size
.layout__item--grow,
et cetera
*/
/*
The basic building block is a layout container that will distribute
its child elements either horizontally or vertically.
*/
.layout {
display: flex;
}
/*
The children of a layout container may be laid either horizontally
or vertically, depending on the `flex-direction` property.
Here we create two modifiers for the .layout box
*/
.layout--hbox {
flex-direction: row;
}
.layout--vbox {
flex-direction: column;
}
/*
A layout that stretches all child elements to the same size.
This is useful for things like sidebars for which we might want
to have a background that stretches all the way down.
(Even if the sidebar only has a little content)
*/
.layout--stretch {
align-items: stretch;
}
/*
The alternative to stretching the child elements is to align
them in some way. In some situations, such as in headers that
contain logos and navigation menus, you may want to align all
children centrally.
*/
.layout--middle {
align-items: center;
}
/*
In situation where we need children to 'float' at opposite directions of the layout,
we can use the `justify-content` property to push them to the edges.
*/
.layout--spread {
justify-content: space-between;
}
.layout--wrap {
flex-wrap: wrap;
}
.layout--centered {
justify-content: space-around;
}
/*
This is the only element we need in a layout block.
By default, a `layout__item` does not need to do anything special.
It has `flex: 0 1 auto` which is a shorthand for:
- flex-grow: 0
- flex-shrink: 1
- flex-basis: auto
We do however set `overflow: hidden` on it, so that we can enable
scrolling on items that need it (see modifiers below).
*/
.layout__item {
flex: 0 1 auto;
overflow: hidden;
}
/*
This is a layout item that permits its children to overflow
*/
.layout__item--overflow {
overflow: visible;
}
/*
A layout item that grows to fill the available space.
*/
.layout__item--grow {
flex-grow: 1;
}
/*
A layout item that shows a scrollbar in case its content overflows
*/
.layout__item--scroll {
overflow-y: auto;
overflow-x: hidden;
}
/*
A layout item that maintains a fixed size.
(Either width or height, depending on how the items are laid out)
This is accomplished by setting both `flex-grow` and `flex-shrink` to 0,
in effect disabling the flexibility on the item.
*/
.layout__item--fixed-size {
flex-grow: 0;
flex-shrink: 0;
box-sizing: border-box;
}
/*
For items with a fixed size, we control that size by setting the
`flex-basis` property rather than the `width` or `height` property.
Below, we define a couple of sizes that are used throughout the layout.
*/
.layout__item--width-medium {
flex-basis: 16em;
}
.layout__item--height-small {
flex-basis: 3.5em;
max-height: 3.5em;
}
.layout__item--width-10 {
flex-basis: 10%;
}
.layout__item--width-15 {
flex-basis: 15%;
}
.layout__item--width-20 {
flex-basis: 20%;
}
.layout__item--width-25 {
flex-basis: 25%;
}
.layout__item--width-30 {
flex-basis: 30%;
}
.layout__item--width-50 {
flex-basis: 50%;
}
.layout__item--width-60 {
flex-basis: 60%;
}
.layout__item--width-70 {
flex-basis: 70%;
}
.layout__item--width-75 {
flex-basis: 75%;
}
.layout__item--width-80 {
flex-basis: 80%;
}
.layout__item--width-85 {
flex-basis: 85%;
}
.layout__item--width-90 {
flex-basis: 90%;
}
/*
In general, you'd want to adjust how the app lays out when viewed
on small devices.
Below is a minimal example of turning all flex layouts to normal block layouts.
*/
/*@media (max-width: 40em) {
.layout {
display: block;
}
.layout__item {
max-height: auto !important;
}
}*/