-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHtree.htm
372 lines (333 loc) · 6.94 KB
/
Htree.htm
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Htree</title>
<style>
*, *::before, *::after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
margin: 0;
padding: 0px;
color: #ffffff;
font: 12px Verdana, sans-serif;
background: #000000;
}
.tree {
margin-top: 75px;
margin-left: 20px;
}
/* text boxes */
.tree p {
position: relative;
display: block;
/* changing this impacts other HHH */
width: 140px;
line-height: 20px;
text-align: center;
border: 2px solid #ffffff;
border-radius: 5px;
background: rgba(0, 0, 0, 1.0);
left: 0;
margin-bottom: 0px;
top: 50%;
margin-top: 0px;
z-index: 1;
/* hover action timing */
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
transition: all 0.5s;
}
/* text box background colors */
#yel {
color: #222;
background: rgba(255, 255, 0, 1.0);
}
#blu {
background: rgba(0, 0, 255, 1.0);
}
#grn {
background: rgba(0, 200, 0, 1.0);
}
#red {
background: rgba(205, 0, 100, 1.0);
}
a {
color:white;
}
a:visited {
color: #00FF00;
}
/* vertically align paired <p>'s */
.tree p+p {
position: relative;
top: 0px; /* shift down */
left: 0px; /* vertically align */
margin-top: 10px;
margin-bottom: -30px;
}
/* vertical stem between paired <p>'s */
.tree p+p::before {
position: absolute;
content: '';
border-left: 2px solid #fff;
left: 50%;
top: -12px;
height: 12px;
}
.tree ul { /* sl fails */
position: relative;
top: -35px;
/* changing p width impacts this HHH */
margin-left: 130px;
margin-top: 0px;
padding-bottom: 10px;
}
/* child entries */
.tree li {
position: relative;
clear: left;
}
/* reduce redundant vertical space */
.tree li:last-child {
height: 0px;
margin-bottom: 10px;
}
.tree dt:last-child {
height: 0px;
margin-right: -10px;
}
/* vertical spacing tweaks */
#p20 {
padding-bottom: 20px;
}
#p40 {
padding-bottom: 40px;
}
#u30 {
margin-bottom: -30px;
}
#p60 {
padding-bottom: 60px;
}
/* horizontal branches */
.tree dl {
position: relative;
}
#li-child {
/* changing p width impacts this HHH */
left: -88px;
top: -20px;
margin-top: 0px;
}
.tree li {
position: relative;
float: left;
/* disable list bullets */
list-style-type: none;
padding-top: 10px; /* unlike margin, adds height */
padding-right: 10px;
margin-right: 0px;
}
.tree dt {
position: relative;
float: left;
padding-top: 10px; /* unlike margin, adds height */
padding-right: 10px;
margin-right: 0px;
margin-bottom: 0px;
}
.tree dd {
position: relative;
float: left;
padding-top: 10px; /* unlike margin, adds height */
padding-right: 10px;
margin-right: 0px;
margin-left: 0px;
}
/* horizontal connectors ------------------ */
/* horizontal stems before <li> entries */
.tree li::before {
position: absolute;
content: "";
/* horizontal connector before entry */
border-top: 2px solid #ffffff;
top: 20px;
width: 15px;
left: -15px;
}
/* longer stem from first <li> to parent */
.tree li:first-child::before {
width: 30px;
left: -30px;
}
/* horizontal branches above <dl> entries */
.tree dt::after, dd::after {
position: absolute;
content: "";
border-top: 2px solid #ffffff;
top: -4px;
/* changing p width impacts this HHH */
left: 75px; /* % fails if child dl */
width: 100%;
}
.tree dt:last-child::after, .tree li:last-child::after {
display: none;
}
/* vertical branches */
.tree li::after {
position: absolute;
content: "";
height: 100%;
border-left: 2px solid #ffffff;
min-height: 36px; /* force vertical connections */
left: -15px;
top: 20px;
}
/* vertical branch for parent, left of horizontal entries */
.tree dt:first-child::before {
height: 100%;
left: -15px;
top: 10px;
}
/* vertical stems to branches */
.tree dt::before {
position: absolute;
content: "";
border-left: 2px solid #ffffff;
/* changing p width impacts this HHH */
left: 75px; /* % fails if child dl */
height: 14px;
top: -4px;
}
/* longer vertical stem from first entry to dl parent */
.tree dl::before {
position: absolute;
content: "";
border-left: 2px solid #ffffff;
height: 30px;
top: -18px;
/* changing p width impacts this HHH */
left: 73px;
}
/* Hover effect: colorize boxes */
.tree ul p:hover~p,
.tree li p:hover~dl dd p,
.tree ul p:hover~dl dt p,
.tree ul p:hover~ul li p {
background: #c8f4e8; color: #000;
border: 2px solid #9400a4;
}
/* branch and stem styles on hover */
.tree li p:hover~dl::before,
.tree dt p:hover~dl::before,
.tree li p:hover~p::before,
.tree li p:hover~ul li p::before,
.tree li p:hover~dl dt p::before,
.tree li p:hover~dl dd p::before,
.tree dt p:hover~ul li dl::before,
.tree li p:hover~ul li dl dt::before,
.tree li p:hover~ul li dl dt::after,
.tree li p:hover~ul li dl dd::after,
.tree dt p:hover~ul li dl dt::before,
.tree dt p:hover~ul li dl dt::after,
.tree dt p:hover~ul li dl dd::after,
.tree li p:hover~ul li dl::before,
.tree dt p:hover~dl dt::before,
.tree li p:hover~dl dt::before,
.tree li p:hover~dl dt::after,
.tree dt p:hover~dl dt::after,
.tree li p:hover~dl dd::after,
.tree dt p:hover~dl dd::after,
.tree li p:hover~ul li::before,
.tree dt p:hover~ul li::before,
.tree li p:hover~ul li::after,
.tree dt p:hover~ul li::after
{
border-color: #9400a4;
}
</style>
</head>
<body translate="no">
Horizontal tree adapted from <a href="https://codepen.io/P233/pen/Kzbsi">https://codepen.io/P233/pen/Kzbsi</a><br>
<div class="tree">
<p>Root</p>
<ul>
<li><p>Entry-1</p>
<ul>
<li><p>Entry-1-1</p>
<ul>
<li><p>Entry-1-1-1</p></li>
</ul>
</li>
<li><p>Entry-1-2</p>
<ul>
<li><p>Entry-1-2-1</p></li>
</ul>
</li>
<li><p>Entry-1-3</p>
<ul>
<li><p>Entry-1-3-1</p></li>
</ul>
</li>
</ul>
</li>
<li><p>Entry-2</p>
<dl>
<dt><p>dt child 1<br>multi-line</p></dt>
<dt><p>dt child 2</p></dt>
<dt><p>dt child 3</p></dt>
</dl>
</li>
<li><p>Entry-2.5</p></li>
<li id="p60"><p>Entry-3</p>
<ul>
<li><p>Entry-3-1</p></li>
<li><p>Entry-3-2</p>
<dl>
<dt><p>dt child 1</p></dt>
<dt><p>dt child 2</p></dt>
<dt><p>dt child 3</p></dt>
</dl>
</li>
<li id="u20"><p>Entry-3-3</p>
<ul>
<li><p>Entry-3-3-1</p></li>
<li><p>Entry-3-3-2</p>
<ul>
<li><p>Entry-3-3-2-1</p></li>
<li><p>Entry-3-3-2-2</p><p>Entry-3-3-2-2-1</p></li>
</ul>
</li>
<li><p>Entry-3-3-3</p></li>
</ul>
</li>
<!--
<li><p>Entry-3-4</p>
-->
<li>
<dl id="li-child">
<dd><p>dd child 1<br>multi-line</p><p>paired p</p></dd>
<dt><p>dt child 2</p>
<dl>
<dd><p>dd grandchild</p></dd>
<dt><p>dt grandchild</p></dt>
</dl>
</dt>
<dt><p>dt child 3</p></dt>
</dl>
</li>
<!--
<li><p>Entry-3-5</p></li>
-->
</ul>
</li>
<li><p>Entry-4</p>
</li>
<li><p>Entry-5</p></li>
</ul>
</body>
</html>