-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMenuTree.html
More file actions
368 lines (334 loc) · 7.95 KB
/
MenuTree.html
File metadata and controls
368 lines (334 loc) · 7.95 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
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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<title>Menu Tree</title>
<!--
Tree diagrams are comparable to HTML lists;
this CSS overrides HTML list markup to draw trees.
Tree diagrams have no real trunks,
only leaves (<p>), stems(<li>) and branches (<ul>).
Horizontal trees have chilren right of parents,
so vertical branches and horizontal stems.
CSS dislikes comments nested in comments...
-->
<style type="text/css" media="screen">
* {margin: 0; padding: 0;}
/* shift content down and left */
.tree {
margin-top: 45px;
margin-left: -70px;
}
.tree dl {
/* Do NOT accumulate horizontal position */
position: absolute;
/* horizontal padding for vertical branches */
padding-left: 18px;
}
/* single <p> row entries after <dl> */
.tree dd {
float: left; text-align: center;
/* required for absolute stem positions
* and accumulating horizontal offsets */
position: relative;
/* shift up to align with parent */
top: -44px;
left: 110px;
list-style-type: none;
/* padding for text boxes */
padding: 15px 5px 0px 5px;
}
.tree ul {
/* required for absolute branch positions
* and accumulating vertical offsets */
position: relative;
/* horizontal padding for vertical branches */
padding-left: 17px;
/* disable list bullets */
list-style-type: none;
}
/* single <p> column entries after <ul> */
.tree li {
/* required for absolute stem positions
* and accumulating vertical offsets */
position: relative;
/* shift up to align with parent */
top: -34px;
/* horizontal padding for text boxes */
margin-left: 115px;
/* disable list bullets */
list-style-type: none;
}
#up {
margin-top: -30px;
}
#skip {
margin-left: -6px;
}
/* avoid redundant vertical space */
.tree li:last-child {
height: 0;
}
/* text boxes */
.tree p {
position: relative;
/* content (text and background) */
text-decoration: none;
text-align: center;
color: #666;
font-family: arial, verdana, tahoma;
font-size: 11px;
display: inline-block;
padding: 5px 10px;
background: white;
margin-bottom: 10px;
/* bounding box */
border: 1px solid #000;
min-width: 90px;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
/* hover action timing */
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
transition: all 0.5s;
}
/* text box background colors */
#yel {
background: yellow;
}
#blu {
color: #222;
background: #5af;
}
#grn {
color: #222;
background: #0b0;
}
#red {
color: #222;
background: #f08;
}
/* vertically align paired <p>'s */
.tree p+p {
position: relative;
top: 30px; /* shift down */
left: -112px; /* horizontally align; 100% fails if followed by <dl> */
margin-bottom: 40px; /* vertical spacing */
margin-right: -110px;
}
/* Draw branches and stems using ::before and ::after */
/* vertical stem between paired <p>'s */
.tree li p+p::before {
position: absolute;
content: '';
border-left: 1px solid #000;
left: 50%;
top: -8px;
height: 8px;
}
/* vertical branches */
.tree ul li::before {
position: absolute;
content: '';
border-left: 1px solid #000;
height: 100%;
left: -10px; /* center in <ul> margin */
top: 10px; /* start at stem */
}
/* Horizontal stem from child to branch */
.tree li::before {
border-top: 1px solid #000;
top: 10px; /* vertically center on boxes */
left: -10px; /* start at vertical branch */
width: 10px; /* extend to child left border */
}
/* horizontal stem from parent to branch except for root branch */
.tree ul ul::before { /* double ul required */
position: absolute;
content: '';
border-top: 1px solid #000;
top: -24px; /* vertically center on boxes */
left: 112px; /* start at parent right border */
width: 10px; /* extend to child vertical branch */
}
/* <dl>, <dd> for horizontal branches */
/* short horizontal branch from parent to short vertical branch */
.tree dl::before {
position: absolute;
content: '';
border-top: 1px solid #000;
top: -24px; /* vertically center on boxes */
width: 10px; /* extend to child left border */
left: 112px;
}
/* short vertical branch from short parent to long horizontal (between parent and first child) */
.tree dl::after {
position: absolute;
content: '';
border-left: 1px solid #000;
top: -34px; /* vertically center on boxes */
height: 10px; /* extend to child top border */
left: 121px;
}
/* long horizontal branch above children */
.tree dd::before {
position: absolute;
content: '';
border-top: 1px solid #000;
top: 10px;
width: 100%; /* vertically center on boxes */
left: -62px;
}
/* shorter horizontal branch above first child */
.tree dd:first-child::before {
width: 66px;
left: -6px;
}
/* vertical stem between branch and child */
.tree dd::after {
position: absolute;
content: '';
border-left: 1px solid #000;
top: 10px; /* start at branch */
height: 5px; /* extend to box */
left: 60px; /* horizontally center on boxes */
}
/* Hover effect: colorize boxes */
.tree li p:hover,
.tree li p:hover~ul li p,
.tree li p:hover~ul dl dd p,
.tree li p:hover~dl dd p {
background: #c8f4e8; color: #000;
border: 2px solid #9400a4;
}
/* branch and stem styles on hover */
.tree li p:hover~ul li::before,
.tree li p:hover~dl::before,
.tree li p:hover~dl::after,
.tree li p:hover~ul dl::before,
.tree li p:hover~ul dl::after,
.tree li p:hover~dl dd::before,
.tree li p:hover~dl dd::after,
.tree li p:hover~ul li dl dd::after,
.tree li p:hover~ul li::after {
border-color: #9400a4;
}
</style>
</head>
<body>
<base href="help.htm">
<!--
Create a tree using CSS(3) style above.
HTML nested list markup for connections and <p></p> for boxes
<ul> - generates vertical branches
<li> - generates horizontal stems
Only for right-most generation, use <dl>, <dd> instead of <ul>, <li>
-->
Hacked from <a href="http://thecodeplayer.com/walkthrough/css3-family-tree">http://thecodeplayer.com/walkthrough/css3-family-tree</a><br>
Replaced that vertical CSS style with horizontal from <a href="https://codepen.io/P233/pen/Kzbsi">https://codepen.io/P233/pen/Kzbsi</a><br><br>
<div class="tree">
<ul>
<li>
<p><a href="#U1">Uncle</a> </p>
<ul>
<li>
<p title="tooltip
for orphan"> Orphan Nephew</p>
<dl>
<dd>
<p>Grand Nephew 1</p>
</dd>
<dd>
<p>Grand Nephew 2</p>
</dd>
</dl>
</li>
<li>
<p>Another Nephew</p>
<dl>
<dd>
<p>Grand Nephew 3</p>
</dd>
<dd>
<p>Grand Nephew 4</p>
</dd>
</dl>
</li>
<li>
<p title="look towards bottom
in hyperlink">Favorite <a href="#N1">Nephew</a></p><p>Someone's <a href="#N0">Niece</a></p>
<dl>
<dd>
<p>Grand Niece 0</p>
</dd>
<dd>
<p>Grand Niece 1</p>
</dd>
<dd>
<p>Grand Niece 2</p>
</dd>
<dd>
<p>Grand Niece 3</p>
</dd>
<dd>
<p>Grand Niece 4</p>
</dd>
</dl>
</li>
<li>
<p>Child</p>
<ul>
<li>
<p>Grand Child</p>
</li>
</ul>
</li>
</ul>
</li>
<li>
<p>Parent</p>
<ul>
<li>
<p>Child</p>
<ul>
<li>
<p>Grand Child</p>
</li>
<li>
<p>Sub Parent 1</p><p>Sub Parent 2</p>
</li>
<li><p>Grand Child</p></li>
</ul>
</li>
<li>
<p>Sub Parent 1</p><p>Sub Parent 2</p>
<ul>
<li><p>Grand Child</p><p>Fair Friend</p>
<ul>
<li><p>Vert align</p></li>
<li><p>Check below</p></li>
</ul>
</li>
<li>
<p>Grand Child</p>
<dl>
<dd>
<p>Great Grand Child</p>
</dd>
<dd>
<p>Great Grand Child</p>
</dd>
<dd>
<p>Great Grand Child</p><p>Good Friend</p>
</dd>
</dl>
</li>
<li><p>Grand Child</p></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</body>
</html>