-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path05.items.html
115 lines (92 loc) · 1.99 KB
/
05.items.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
<!doctype html>
<html lang="is">
<head>
<meta charset="utf-8">
<title>Flexbox - items</title>
<!--
Þetta dæmi skilgreinir CSS „inline“ til hægðarauka. Betra væri að vísa í
CSS skjal með <link rel="stylesheet" href="skjal.css">
-->
<style>
body {
margin: 0;
}
.container {
box-sizing: border-box;
width: 100%;
padding: 20px 0 0 20px;
background-color: pink;
margin-right: -10px;
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.box {
/**
* ef við setjum sem 1 fara öll box að vilja vera jafn stór
* í grunninn, sjálfgefið er 0
*/
flex: 1;
display: block;
box-sizing: border-box;
margin-bottom: 20px;
margin-right: 20px;
border: 5px solid #f00;
padding: 50px;
background-color: #000;
color: #fff;
}
.low {
order: -1;
}
.mid {
order: 1;
}
.high {
order: 2;
}
.flex-two {
flex: 2;
}
.flex-three {
flex: 1 0 300px;
}
.self {
align-self: center;
}
.flex {
flex-wrap: nowrap;
}
.flex .box:nth-child(1) {
flex: 1 1 20em;
}
.flex .box:nth-child(2) {
flex: 2 2 20em;
}
</style>
</head>
<body>
<h2>Breyta röð</h2>
<div class="container">
<div class="box mid">1</div>
<div class="box"><span>2</span></div>
<div class="box high">3</div>
<div class="box">4</div>
<div class="box">5</div>
<div class="box low">6</div>
</div>
<h2>Breyta stærð</h2>
<div class="container">
<div class="box flex-three">1</div>
<div class="box">2</div>
<div class="box flex-two">3</div>
<div class="box">4</div>
<div class="box self"></div>
</div>
<h2>Flex</h2>
<div class="container flex">
<div class="box">1</div>
<div class="box">2</div>
</div>
</body>
</html>