-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path09-Width, Height & Layout Basics.html
More file actions
69 lines (61 loc) · 1.55 KB
/
09-Width, Height & Layout Basics.html
File metadata and controls
69 lines (61 loc) · 1.55 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>09-Width, Height & Layout Basics</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
/* Example 1 */
.fixed-box {
background: lightblue;
width: 300px;
height: 200px;
padding: 20px;
border: 5px solid black;
margin: 20px;
}
/* Example 2 */
.responsive-box {
background: pink;
width: 100%;
max-width: 50%;
padding: 20px;
border: 5px solid black;
margin: 20px auto;
text-align: center;
}
.parent {
width: 50%;
background: lightgray;
border: 5px solid black;
margin: 20px auto;
padding: 20px;
}
.child {
background: pink;
border: 3px solid black;
padding: 10px;
margin-bottom: 10px;
}
</style>
</head>
<body>
<!-- Fixed Size Box -->
<div class="fixed-box">This is a fixed width & height box</div>
<!-- Responsive max-width Example -->
<div class="responsive-box">
This box uses width: 100% with max-width: 50%
</div>
<!-- Percentage Based Layout -->
<div class="parent">
<div class="child" style="width: 33%">Child Box 33%</div>
<div class="child" style="width: 66%">Child Box 66%</div>
<div class="child" style="width: 99%">Child Box 99%</div>
</div>
</body>
</html>