-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchapter21.html
More file actions
134 lines (129 loc) Β· 3.31 KB
/
chapter21.html
File metadata and controls
134 lines (129 loc) Β· 3.31 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chapter 21: Advanced CSS</title>
<link rel="stylesheet" href="style.css">
<style>
/* CSS Variables */
:root {
--a-global-color: red;
}
.variable-demo {
--a-local-color: blue;
border: 1px solid #ccc;
padding: 10px;
margin: 5px 0;
}
.variable-demo .demo-header {
color: var(--a-global-color);
font-weight: bold;
}
.variable-demo .demo-footer {
color: var(--a-local-color);
font-style: italic;
}
.main-footer {
color: gray;
margin-top: 5px;
}
/* CSS Calculation */
.calc-box {
border: 1px solid #999;
margin: 5px 0;
}
.calc-header, .calc-footer {
height: 30px;
line-height: 30px;
text-align: center;
font-weight: bold;
}
.calc-header {
border-bottom: 1px solid black;
}
.calc-footer {
border-top: 1px solid black;
}
.calc-content {
min-height: calc(200px - 60px); /* compact */
padding: 10px;
}
.long-content {
border: 1px solid #ccc;
padding: 5px;
margin-top: 10px;
}
/* CSS Counters */
.counter-demo {
font-size: 14px;
counter-reset: my-section;
border: 1px dashed #aaa;
padding: 10px;
margin: 5px 0;
}
.counter-demo h3 {
counter-reset: my-sub-section;
margin-top: 10px;
}
.counter-demo h3::before {
counter-increment: my-section;
content: "Section " counter(my-section) ". ";
font-weight: bold;
color: darkred;
}
.counter-demo h4::before {
counter-increment: my-sub-section;
content: counter(my-section) "." counter(my-sub-section) " ";
color: darkblue;
margin-right: 5px;
}
</style>
</head>
<body>
<h2 class="chapter-header" id="heading">Chapter 21: Advanced CSS</h2>
<div class="tag-section">
<h3>1.1 CSS Variables</h3>
<div class="tag-demo">
<div class="head-demo">
<div class="variable-demo">
<div class="demo-header">This is a heading (red - global variable)</div>
<p>This is a normal paragraph.</p>
<div class="demo-footer">This is a section footer (blue - local variable).</div>
</div>
<div class="main-footer">This is the main footer (cannot access local variable).</div>
</div>
</div>
</div>
<div class="tag-section">
<h3>1.2 CSS Calculation</h3>
<div class="tag-demo">
<div class="head-demo">
<div class="calc-box">
<div class="calc-header">Header</div>
<div class="calc-content">
<p>This is a paragraph.</p>
<p class="long-content">Resize the container to see footer behavior.</p>
</div>
<div class="calc-footer">Footer</div>
</div>
</div>
</div>
</div>
<div class="tag-section">
<h3>1.3 CSS Counters</h3>
<div class="tag-demo">
<div class="head-demo">
<div class="counter-demo">
<h3>HTML tutorials:</h3>
<h4>HTML Tutorial</h4>
<h4>CSS Tutorial</h4>
<h3>Scripting tutorials:</h3>
<h4>JavaScript</h4>
<h4>VBScript</h4>
</div>
</div>
</div>
</div>
</body>
</html>