Skip to content

Instantly share code, notes, and snippets.

@tst32
Last active April 13, 2021 12:00
Show Gist options
  • Save tst32/611d3636caa49f83c32e34ded7b6fee7 to your computer and use it in GitHub Desktop.
Save tst32/611d3636caa49f83c32e34ded7b6fee7 to your computer and use it in GitHub Desktop.
Checkboxes - The first commented line is your dabblet’s title
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/**
* Checkboxes - The first commented line is your dabblet’s title
*/
.checkbox-on-off {
position: relative;
display: inline-block;
width: auto;
padding-right: 2px;
overflow: hidden;
vertical-align: middle;
margin-top: 10px;
}
.checkbox-on-off input[type=checkbox] {
position: absolute;
opacity: 0;
}
.checkbox-on-off input[type=checkbox]:checked+label {
background-color: lightblue;
}
.checkbox-on-off label {
display: inline-block;
border: 1px solid transparent;
height: 300px;
width: 300px;
background: #b8b8b8;
cursor: pointer;
border-radius: 20px;
}
.checkbox-on-off input[type=checkbox]:checked+label .checked {
display: inline-block;
margin-top: 0px;
margin-left: 0px;
background: no-repeat url('https://gist.githubusercontent.com/tst32/611d3636caa49f83c32e34ded7b6fee7/raw/9df9282b32b63c236e26e690aed8ada7db349173/bytile.svg');
background-size: auto;
width: 100%;
height: 100%;
}
.checkbox-on-off label .checked {
display: none;
background: no-repeat url('https://gist.githubusercontent.com/tst32/611d3636caa49f83c32e34ded7b6fee7/raw/9df9282b32b63c236e26e690aed8ada7db349173/bylist.svg');
}
.checkbox-on-off input[type=checkbox]:checked+label .unchecked {
display: none;
background: no-repeat url('https://gist.githubusercontent.com/tst32/611d3636caa49f83c32e34ded7b6fee7/raw/9df9282b32b63c236e26e690aed8ada7db349173/bytile.svg');
}
.checkbox-on-off label .unchecked {
display: inline-block;
float: right;
padding-right: 3px;
}
.checkbox-on-off input[type=checkbox]:checked+label .toggle {
float: right;
}
.checkbox-on-off label .toggle {
float: left;
background: #fbfbfb;
height: 15px;
width: 13px;
border-radius: 20px;
}
<!-- content to be placed inside <body>…</body> -->
<span class="checkbox-on-off ">
<input id="autoplay-checkbox" class="" type="checkbox" checked="">
<label for="autoplay-checkbox" id="autoplay-checkbox-label">
<span class="checked">&nbsp;</span>
<span class="unchecked"></span>
<span class="toggle">&nbsp;</span>
</label>
</span>
<span class="checkbox-on-off ">
<input id="autoplay-checkbox" class="" type="checkbox" checked="">
<label for="autoplay-checkbox" id="autoplay-checkbox-label">
<span class="checked">&nbsp;</span>
<span class="unchecked"></span>
<span class="toggle">&nbsp;</span>
</label>
</span>
// alert('Hello world!');
{"view":"split","fontsize":"90","seethrough":"1","prefixfree":"1","page":"all"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment