-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path16_flexbox.html
More file actions
73 lines (70 loc) · 2.4 KB
/
16_flexbox.html
File metadata and controls
73 lines (70 loc) · 2.4 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title> CSS flexbox</title>
<style>
.container{
border: 2px solid blue;
display: flex;
/* make items form left to right and changes the default behaviour */
height: 80vh;
/* flex-wrap: wrap;helps in optimisatin */
justify-content: center; centers in horizontal way
/* align-items: center; centers in vertical way */
/* flex-direction: column; makes item into row
flex-direction: column-reverse; invert the items last to first and first to last */
align-content: center;
/* flex-flow: row wrap; */
/* ye property dir and wrap set krne ke kaam aati hai */
/* gap: 30px; */
row-gap: 20px;
column-gap: 20px;
flex-grow: 1;/* har element equal jgha lega iska opposite flex shrink*/
}
/* order element helps the flex item to display in order */
.order1{
order: 2;
flex-grow: 2;
align-self: flex-end ;
/* specific item ko end ya start mai rkhna */
}
.order2{
align-self: flex-start;
order: 1;
}
.item{
width: 92px;
height: 92px;
border: 2px solid black;
/* margin: 2px; */
background-color: lightblue;
}
</style>
</head>
<body>
<main>
<div class="container">
<div class="item order1">1</div>
<div class="item order2">2</div>
<div class="item">3</div>
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
<div class="item">7</div>
<div class="item">8</div>
<div class="item">9</div>
<div class="item">10</div>
<div class="item">11</div>
<div class="item">12</div>
<div class="item">13</div>
<div class="item">14</div>
<div class="item">15</div>
<div class="item">16</div>
<div class="item">17</div>
<div class="item">18</div>
</div>
</main>
</body>
</html>