CSS treeview
Platform: CSS
Published Apr 05, 2012
Updated Apr 06, 2012
this is an example of how to make a treeview without the use of javascript.
image files located here -
Example
example html:
note: the ID attribute for the input/label pairs must be identical and unique
adding a checked attribute to the input element will make it expand by default and the disabled attribute will disable toggling for that list
#treeview article * { padding-left: 10px; }
#treeview article *:not(:nth-child(2)) { margin-left: 10px; }
.treeview { display: none; }
.treeview:checked + label { background: URL("plus.png") left center no-repeat; }
.treeview:not(:checked) ~ label { background: URL("minus.png") left center no-repeat; }
.treeview:checked ~ *:not(:nth-child(2)) { display: none; }
.treeview:disabled ~ * { color: #707070; }