/* https://codepen.io/defims/pen/DBaVXM */ ul { float: left; clear: left; margin-left: .25em; padding: 0; } ul:before { content:""; position: absolute; z-index: 1; top:.25em; right:auto; bottom:0; left: 1.75em; margin: auto; /* border-right: dotted white .1em; */ width: 0; height: auto; } ul:after { content: "-"; position: absolute; z-index: 3; top: 0; left: -.5em; margin-left: .65em; margin-top: .15em; padding: 0; width: .8em; height: .8em; text-align: center; line-height: .7em; font-size: 1em; } ul > li { display: block; position: relative; float: left; clear: both; right:auto; padding-left: 1em; width:auto; text-align: center; color:white; } ul > li > input[type=checkbox] { display:block; position: absolute; float: left; z-index: 4; margin: 0 0 0 -1em; padding: 0; width:1em; height: 2em; font-size: 1em; opacity: 0; cursor: pointer; } ul > li > input[type=checkbox]:not(:checked)~ul:before { display: none; } ul > li > input[type=checkbox]:not(:checked)~ul:after { content: "+" } ul > li > input[type=checkbox]:not(:checked)~ul * { display: none; } ul > li > span { display: block; position: relative; float: left; z-index: 3; margin-left: .25em; padding-left: .25em; } ul > li > span:after { content: ""; display: block; position: absolute; left:-1em; top:0; bottom:0; margin: auto .25em auto .25em; /* border-top: dotted white .1em; */ width: .75em; height: 0; } ul > li:last-child:before { content: ""; display: block; position: absolute; z-index: 2; top:1em; left:0; bottom:-.25em; width:.75em; height:auto; } #tree { position: relative; font-family: "Georgia"; } #tree:before { left:.5em; } #tree:after { display: none; } /* decoration */ ul, ul > li:last-child:before { background: transparent; } ul > li { background: transparent; } ul:after { background: linear-gradient(135deg, rgba(255,255,255,1), rgba(195,186,170,1)); color: black; border:solid gray 1px; border-radius: .1em; } ul > li > span { border-radius: .25em; color: white; } ul > li > input[type=checkbox]~span:before { content:""; display: inline-block; margin: 0 .25em 0 0; width:1em; height: 1em; ;line-height: 1em; content: '\1F4C1'; background-repeat:no-repeat; background-size:contain; } ul > li > input[type=checkbox]:checked~span:before { content: '\1F4C2'; }