Skip to content

Instantly share code, notes, and snippets.

@jimmy89Li
Created September 20, 2016 09:01
Show Gist options
  • Save jimmy89Li/d10df9522ab40acb84a7c3d2506378c9 to your computer and use it in GitHub Desktop.
Save jimmy89Li/d10df9522ab40acb84a7c3d2506378c9 to your computer and use it in GitHub Desktop.
Div as checked input button
<div id="Type1" class="packages" >
<p>Type 1</p>
<div class="optionsContainer">
<input type="radio" name="type1" id="package11">
<label class="radio-inline package-options" for="package11">Package #1.1</label>
<input type="radio" name="type1" id="package12">
<label class="radio-inline package-options" for="package12">Package #1.2</label>
<input type="radio" name="type1" id="package13">
<label class="radio-inline package-options" for="package13">Package #1.3</label>
</div>
</div>
<style>
.packages .package-options{
color: #fff;
background-color:#c5e043;
display:inline-block;
width:100px;
height:100px
}
.packages input[type=radio]{
display:none
}
.packages input[type=radio]:checked + .package-options{
background-color:#241009
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment