-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchapter14.html
More file actions
196 lines (180 loc) Β· 4.7 KB
/
chapter14.html
File metadata and controls
196 lines (180 loc) Β· 4.7 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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chapter 14: CSS Box Model</title>
<link rel="stylesheet" href="style.css">
<style>
/* Box Sizing Demo */
#box-border {
width: 200px;
height: 200px;
padding: 10px;
border: 5px solid red;
margin: 8px;
box-sizing: border-box;
background: lightblue;
}
#box-content {
width: 200px;
height: 200px;
padding: 10px;
border: 5px solid green;
margin: 8px;
box-sizing: content-box;
background: lightyellow;
}
/* Margin Demo */
#margin-child {
border: 1px solid red;
margin: 50px 30px;
}
#auto-margin {
border: 1px solid blue;
width: 200px;
margin: auto;
}
#collapse-one {
border: 1px solid red;
margin: 30px;
}
#collapse-two {
border: 1px solid blue;
margin: 60px;
}
/* Outline Demo */
.outline-demo {
border: 1px solid black;
outline: 5px dotted red;
padding: 10px;
}
/* Border Styles Demo */
.border-style {
border: 5px groove red;
padding: 10px;
}
/* Border Radius Demo */
#radius-1 {
border-radius: 10px;
background: green;
width: 100px;
height: 50px;
margin-bottom: 10px;
}
#radius-2 {
border-radius: 50%;
background: orange;
width: 100px;
height: 100px;
}
/* Border Image Demo (using gradient for simplicity) */
#border-img-round {
border: 20px solid transparent;
padding: 15px;
border-image: linear-gradient(red, yellow) 30 round;
}
#border-img-stretch {
border: 20px solid transparent;
padding: 15px;
border-image: linear-gradient(blue, cyan) 30 stretch;
}
/* Padding Demo */
.padding-demo {
border: 1px solid black;
padding: 20px;
}
/* Width & Height Demo */
#wh-normal {
border: 1px solid black;
width: 100px;
height: 100px;
}
#wh-max {
border: 1px solid black;
max-width: 100px;
max-height: 100px;
}
#wh-min {
border: 1px solid black;
min-width: 100px;
min-height: 100px;
}
</style>
</head>
<body>
<h2 class="chapter-header">Chapter 14: CSS Box Model</h2>
<!-- Box Sizing -->
<div class="tag-section">
<h3>Box Sizing</h3>
<div class="tag-demo">
<div class="head-demo" id="box-border">Border-box (size includes padding & border)</div>
<div class="head-demo" id="box-content">Content-box (size excludes padding & border)</div>
</div>
</div>
<!-- Margins -->
<div class="tag-section">
<h3>Margins</h3>
<div class="tag-demo">
<div class="head-demo" id="margin-child">Normal Margin (50px top/bottom, 30px sides)</div>
<div class="head-demo" id="auto-margin">Auto Margin (centered horizontally)</div>
<div class="head-demo">
<div id="collapse-one">Collapsing Margin 30px</div>
<div id="collapse-two">Collapsing Margin 60px</div>
</div>
</div>
</div>
<!-- Outline -->
<div class="tag-section">
<h3>Outline</h3>
<div class="tag-demo">
<div class="head-demo outline-demo">This paragraph has dotted red outline outside border</div>
</div>
</div>
<!-- Borders -->
<div class="tag-section">
<h3>Borders</h3>
<div class="tag-demo">
<div class="head-demo border-style">This box has a groove border</div>
</div>
</div>
<!-- Border Radius -->
<div class="tag-section">
<h3>Border Radius</h3>
<div class="tag-demo">
<div class="head-demo">
<div id="radius-1"></div>
<div >Rounded corners (10px)</div>
</div>
<div class="head-demo">
<div id="radius-2"></div>
<div >Circle (50%)</div>
</div>
</div>
</div>
<!-- Border Image -->
<div class="tag-section">
<h3>Border Image</h3>
<div class="tag-demo">
<div class="head-demo" id="border-img-round">Border with round repeat</div>
<div class="head-demo" id="border-img-stretch">Border with stretched gradient</div>
</div>
</div>
<!-- Padding -->
<div class="tag-section">
<h3>Padding</h3>
<div class="tag-demo">
<div class="head-demo padding-demo">This box has 20px padding inside border</div>
</div>
</div>
<!-- Width & Height -->
<div class="tag-section">
<h3>Width & Height</h3>
<div class="tag-demo">
<div class="head-demo" id="wh-normal">100x100 fixed size</div>
<div class="head-demo" id="wh-max">Max width & height 100px</div>
<div class="head-demo" id="wh-min">Min width & height 100px</div>
</div>
</div>
</body>
</html>