body { font-family: 'Dejavu Sans Mono', 'Arial', sans-serif; font-size: 13px; } * { margin: 0; padding: 0; } .tree-html ul { margin-left: 15px; } .tree-html li { list-style-type: none; margin: 10px; position: relative; } .tree-html li::before { content: ""; position: absolute; top: -7px; left: -15px; border-left: 1px dotted #ccc; border-bottom: 1px dotted #ccc; width: 15px; height: 15px; } .tree-html li::after { position: absolute; content: ""; top: 8px; left: -15px; border-left: 1px dotted #ccc; width: 15px; height: 100%; } .tree-html li:last-child::after { display: none; } ul.tree-html>li:first-child::before { display: none; } .tree-html li a { padding: 2px 5px; } .tree-html li a:hover, .tree-html li a:hover+ul li a, .tree-html li a:focus, .tree-html li a:focus+ul li a { background: gray; } .tree-html label { margin: .2em 0 0 -.6em; position: absolute; border: 1px solid #ccc; background: white; width: .6em; height: .6em; display: inline-block; line-height: .65; } .tree-html label.placeholder { visibility: hidden; } .tree-html label::before { color: #ccc; font-family: serif; margin-left: 0.02em; } input[type='checkbox'] { margin-left: 5px; display: none } input[type='checkbox']:checked ~ ul { display: none } input[type="checkbox"] + label::before { content: '-'; } input[type="checkbox"]:checked + label::before { content: '+'; }