
Untitled
By: a guest on
Jul 17th, 2012 | syntax:
None | size: 1.25 KB | hits: 12 | expires: Never
Webkit input:checked list visibility
ul.tree
{
text-align: left;
}
ul.tree li
{
position: relative;
list-style: none;
}
li.file
{
background: url(images/icons/default_document.png) 0 0 no-repeat;
background-size: 1.5em 1.5em;
}
li.file a
{
display: block;
text-decoration: none;
}
ul.tree li input
{
position: absolute;
top: 0;
left: 0;
cursor: pointer;
opacity: 0;
z-index: 2;
}
ul.tree li input + label + ul
{
margin: 1em 0 1em 2em;
}
ul.tree li input + label + ul > li
{
display: none;
}
ul.tree li label
{
background: url(images/icons/Closed_32x32x32.png) 0 0 no-repeat;
background-size: 1.3em 1.3em;
cursor: pointer;
display: block;
}
ul.tree li input:checked + label
{
background-image: url(images/icons/Open_32x32x32.png);
}
ul.tree li input:checked + label + ul
{
margin: 0 0 0 3em;
}
ul.tree li input[type=checkbox]:checked + label + ul > li.file
{
display: list-item;
margin: 0;
}
<ul class="tree">
<li>
<input type="checkbox" id="subfolder1" /><label for="subfolder1">Some Label</label>
<ul>
<li class="file"><a href="path/to/file1">file1</a></li>
<li class="file"><a href="path/to/file2">file2</a></li>
</ul>
</li>
</ul>