-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflexbox.html
More file actions
85 lines (74 loc) · 2.06 KB
/
flexbox.html
File metadata and controls
85 lines (74 loc) · 2.06 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>FlexBox Demo</title>
<style>
* {
box-sizing: border-box;
}
body {
font-family: Arial, Helvetica, sans-serif;
}
.flex-container {
display: flex;
/* flex-direction: column; */
/* flex-wrap: wrap; */
}
.item {
background: #f4f4f4;
border: solid 2px #cccccc;
margin: 10px;
padding: 10px;
text-align: center;
border-radius: 10px;
/* width: 200px; */
/* 1 -grow 0 -shrink 200px basis*/
/* flex:1 0 200px; */
flex: 1; /* mostly used */
}
/* .item-3{
flex: 3;
} */
/* flex-shrink, flex-grow, flex-basis can be combined to one property using */
/* .item-1{
flex-shrink: 0;
} */
/* mostly used to be exact look for all child elements*/
/* .item-2{
flex-grow: 1;
flex-basis: 0;
} */
/*
.item-3{
flex-grow: 2;
flex-basis: 0;
} */
</style>
</head>
<body>
<!--Flexbox modern layout in css3, flex is value for the display property
replaces float
aligns items both horizontal and vertical
flex items can be reordered using css
parent container - flex container
child containers - flex items
justify-content : align along main axis horizontal
align-items: align items along cross axis vertical
align-content: align when extra space in cross axis-->
<!-- flex-container - Flex Container
item item-1 item item-3 item item-3 - flex items -->
<div class="flex-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>