A Pen by Po-Ying Chen on CodePen.
-
-
Save image72/a3334cb99d9ef6ddf25e1a44698e3360 to your computer and use it in GitHub Desktop.
CSS Tree Menu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#demo | |
%ul.tree-menu | |
%li | |
%input#demo1-1{:checked => "true", :name => "demo1-1", :type => "checkbox"}/ | |
%label{:for => "demo1-1"} item 1 | |
%ul | |
%li | |
%a{:href => "#"} item 1-1 | |
%li | |
%input#demo1-1-2{:checked => "true", :name => "demo1-1-2", :type => "checkbox"}/ | |
%label{:for => "demo1-1-2"} item 1-2 | |
%ul | |
%li | |
%a{:href => "#"} item 1-2-1 | |
%li | |
%a{:href => "#"} item 1-2-2 | |
%li | |
%a{:href => "#"} item 1-2-3 | |
%li | |
%a{:href => "#"} item 1-3 | |
%li | |
%input#demo1-2{:checked => "true", :name => "demo1-2", :type => "checkbox"}/ | |
%label{:for => "demo1-2"} item 2 | |
%ul | |
%li | |
%a{:href => "#"} item 2-1 | |
%li | |
%a{:href => "#"} item 2-2 | |
%li | |
%a{:href => "#"} item 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import compass | |
body | |
padding: 50px 0 | |
color: #666 | |
a | |
text-decoration: none | |
color: #1ab4ff | |
#demo | |
width: 300px | |
margin: 0 auto | |
.tree-menu | |
font-size: 14px | |
line-height: 24px | |
overflow: hidden | |
input[type=checkbox] | |
display: none | |
ul | |
margin: 0 0 0 20px | |
display: none | |
position: relative | |
&:before | |
content: '' | |
position: absolute | |
top: -12px | |
bottom: 12px | |
border-left: 1px #EEE solid | |
left: -30px | |
label | |
cursor: pointer | |
input[type=checkbox]:checked | |
~ ul | |
display: block | |
~ label | |
color: #CCC | |
li | |
list-style: none | |
position: relative | |
&:before | |
content: '' | |
position: absolute | |
width: 25px | |
border-bottom: 1px #EEE solid | |
z-index: -1 | |
left: -30px | |
top: 12px | |
> li | |
margin-left: 10px |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment