-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path14-Flexbox vs Grid (Interview Focus).html
More file actions
65 lines (59 loc) · 1.66 KB
/
14-Flexbox vs Grid (Interview Focus).html
File metadata and controls
65 lines (59 loc) · 1.66 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>14 - Flexbox vs Grid (Interview Focus)</title>
<style>
/* ---------------- FLEXBOX STYLES ---------------- */
.flex-container {
display: flex; /* Activate Flexbox */
justify-content: center; /* Horizontal alignment */
align-items: center; /* Vertical alignment */
gap: 10px; /* Space between items */
padding: 10px;
height: 100vh; /* Full viewport height */
border: 2px solid black;
}
.box {
background-color: lightblue;
padding: 20px;
font-size: 24px;
text-align: center;
border: 1px solid black;
}
/* ---------------- GRID STYLES ---------------- */
.grid-container {
display: grid; /* Activate Grid */
grid-template-columns: repeat(3, 1fr); /* 3 equal columns */
gap: 10px;
padding: 10px;
}
.g {
background-color: lightgreen;
padding: 20px;
font-size: 24px;
text-align: center;
border: 1px solid black;
}
</style>
</head>
<body>
<!-- FLEXBOX EXAMPLE -->
<div class="flex-container">
<div class="box">1</div>
<div class="box">2</div>
<div class="box">3</div>
<div class="box">4</div>
</div>
<!-- GRID EXAMPLE -->
<div class="grid-container">
<div class="g">1</div>
<div class="g">2</div>
<div class="g">3</div>
<div class="g">4</div>
<div class="g">5</div>
<div class="g">6</div>
</div>
</body>
</html>