Skip to content

Instantly share code, notes, and snippets.

@bergwerf
Created April 9, 2017 18:05
Show Gist options
  • Save bergwerf/4a1c1dc4dd7f6e57162dac551ba0fe5e to your computer and use it in GitHub Desktop.
Save bergwerf/4a1c1dc4dd7f6e57162dac551ba0fe5e to your computer and use it in GitHub Desktop.
Simple CSS checkbox
// Copyright (c) 2017, Herman Bergwerf. All rights reserved.
// Use of this source code is governed by a MIT-style license
// that can be found in the LICENSE file.
.checkbox {
font-family: KaTeX_Main;
user-select: none;
padding: .3em;
&:before {
content: '✓';
display: inline-block;
vertical-align: text-bottom;
margin-right: .5em;
padding-left: .05em;
width: .95em;
height: 1em;
line-height: 1.2em;
text-align: center;
border: 1px solid #000;
color: rgba(0, 0, 0, 0);
}
&:hover {
cursor: pointer;
&:before {
color: rgba(0, 0, 0, .2);
}
}
&.checked:before {
color: rgba(0, 0, 0, 1);
}
&:focus {
outline: 1px dotted;
background: #f5f5f5;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment