-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path02-flex-align.html
More file actions
84 lines (79 loc) · 1.74 KB
/
Copy path02-flex-align.html
File metadata and controls
84 lines (79 loc) · 1.74 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
<!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>Flex Align</title>
<style>
#container {
background: #555;
display: flex;
flex-wrap: wrap;
/* Align items horizontal */
justify-content: space-evenly;
/*
OPTIONS:
flex-start
flex-end
center
space-between
space-around
space-evenly
*/
height: 600px;
/* Align items vertical (must be height) */
align-items: baseline;
/*
OPTIONS:
flex-start
flex-end
center
baseline
stretch
*/
/* Align items vertical where extra space */
align-content: space-between;
/*
OPTIONS:
flex-start
flex-end
center
space-between
space-around
stretch
*/
}
.item-1 { order: 3; }
.item-2 {
/* Align single item vertical */
align-self: center;
/*
OPTIONS:
flex-start
flex-end
center
baseline
stretch;
*/
order: 2
}
.item-3 { order: 1; }
.item {
padding: 1rem;
margin: 0.5rem;
background-color: #f4f4f4;
text-align: center;
border: 1px solid #ccc;
flex-basis: 200px;
}
</style>
</head>
<body>
<div id="container">
<div class="item item-1"><h3>Item 1</h3></div>
<div class="item item-2"><h3>Item 2</h3></div>
<div class="item item-3"><h3>Item 3</h3></div>
</div>
</body>
</html>