Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 17th, 2012  |  syntax: None  |  size: 1.25 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Webkit input:checked list visibility
  2. ul.tree
  3. {
  4.    text-align: left;
  5. }
  6.  
  7. ul.tree li
  8. {
  9.    position: relative;  
  10.    list-style: none;
  11. }
  12.  
  13. li.file
  14. {
  15.    background: url(images/icons/default_document.png) 0 0 no-repeat;
  16.    background-size: 1.5em 1.5em;
  17. }
  18.  
  19. li.file a
  20. {
  21.    display: block;
  22.    text-decoration: none;
  23. }
  24.  
  25. ul.tree li input
  26. {  
  27.    position: absolute;
  28.    top: 0;
  29.    left: 0;
  30.  
  31.    cursor: pointer;
  32.  
  33.    opacity: 0;
  34.    z-index: 2;
  35. }
  36.  
  37. ul.tree li input + label + ul
  38. {  
  39.    margin: 1em 0 1em 2em;
  40. }
  41.  
  42. ul.tree li input + label + ul > li
  43. {
  44.    display: none;
  45. }
  46.  
  47. ul.tree li label
  48. {  
  49.    background: url(images/icons/Closed_32x32x32.png) 0 0 no-repeat;
  50.    background-size: 1.3em 1.3em;
  51.  
  52.    cursor: pointer;
  53.  
  54.    display: block;
  55. }
  56.  
  57. ul.tree li input:checked + label
  58. {
  59.    background-image: url(images/icons/Open_32x32x32.png);
  60. }
  61.  
  62. ul.tree li input:checked + label + ul
  63. {
  64.    margin: 0 0 0 3em;
  65. }
  66.  
  67. ul.tree li input[type=checkbox]:checked + label + ul > li.file
  68. {
  69.    display: list-item;
  70.  
  71.    margin: 0;
  72. }
  73.        
  74. <ul class="tree">
  75.    <li>
  76.       <input type="checkbox" id="subfolder1" /><label for="subfolder1">Some Label</label>
  77.       <ul>
  78.          <li class="file"><a href="path/to/file1">file1</a></li>
  79.          <li class="file"><a href="path/to/file2">file2</a></li>
  80.       </ul>
  81.    </li>
  82. </ul>