Last Updated: February 25, 2016
·
4.186K
· isochronous

CSS-based tree node lines

A method for adding the lines that connect nodes in a tree that requires only a single 1x1 pixel image. Requires no extra markup (aside from two extra classes on the root UL), data attributes, or scripts. There are scripts loaded in the demo, but that's only so the tree will be actually collapsible/expandable.

http://jsfiddle.net/isochronous/2N5EP/

The technique requires support for multiple backgrounds on a single element, the background-size property, and background-offset.

Update: I've updated the fiddle to remove all the extra classes (HTML5 shim, reset classes, etc) and added comments to explain how everything works. check it out!

1 Response
Add your response

I had some problems with my hosting so the line image wasn't showing up for a while, but the issue has been resolved and the fiddle should appear properly now.

over 1 year ago ·