Created
July 14, 2015 14:13
-
-
Save daveaseeman/5815dcd9bd784f2970cf to your computer and use it in GitHub Desktop.
show/hide div with css
This file contains 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
.collapse{ | |
display:inline-block; | |
} | |
.collapse + input{ | |
display:none; | |
} | |
.collapse + input + *{ | |
display:none; | |
} | |
.collapse+ input:checked + *{ | |
display:inline-block; | |
} |
This file contains 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
<div> | |
<label class="collapse" for="_1">click this text</i></label><input id="_1" type="checkbox"> to show/hide div. | |
<div> | |
<p>div content</p> | |
</div> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment