Skip to content

Instantly share code, notes, and snippets.

@daveaseeman
Created July 14, 2015 14:13
Show Gist options
  • Save daveaseeman/5815dcd9bd784f2970cf to your computer and use it in GitHub Desktop.
Save daveaseeman/5815dcd9bd784f2970cf to your computer and use it in GitHub Desktop.
show/hide div with css
.collapse{
display:inline-block;
}
.collapse + input{
display:none;
}
.collapse + input + *{
display:none;
}
.collapse+ input:checked + *{
display:inline-block;
}
<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