Skip to content

Instantly share code, notes, and snippets.

@lineharo
Created May 28, 2019 13:42
Show Gist options
  • Save lineharo/4fc71ba299dfd0e3f53877633e7bff0b to your computer and use it in GitHub Desktop.
Save lineharo/4fc71ba299dfd0e3f53877633e7bff0b to your computer and use it in GitHub Desktop.
<style>
body {
margin: 0;
padding: 25px;
font-family: sans-serif;
}
/* Option */
.option {
display: block;
margin-bottom: 0.5em;
}
/* Check */
.check {
padding-left: 1.2em;
}
.check__input {
position: absolute;
width: 1px;
height: 1px;
overflow: hidden;
clip: rect(0 0 0 0);
}
.check__box {
position: absolute;
margin-top: 0.2em;
margin-left: -1em;
width: 0.6em;
height: 0.6em;
overflow: hidden;
border-radius: 0.05em;
background-color: white;
background-repeat: no-repeat;
background-position: 50% 50%;
box-shadow: 0 0 0 0.1em #4A90E2;
}
/* Checked */
.check__input:checked + .check__box {
background-color: #4A90E2;
background-image: url(https://cdn.glitch.com/d6162378-5823-4160-a555-3d9789bd2b92%2Fcheck.svg?1550563475518);
}
/* Focused */
.check__input:focus + .check__box {
box-shadow:
0 0 0 0.1em #4A90E2,
0 0 0 0.2em #7ED321;
}
/* Disabled */
.check__input:disabled + .check__box {
box-shadow: 0 0 0 0.1em #9B9B9B;
}
.check__input:checked:disabled + .check__box {
background-color: #9B9B9B;
}
</style>
</head>
<body>
<label class="check option">
<input class="check__input" type="checkbox">
<span class="check__box"></span>
Первый
</label>
<label class="check option">
<input class="check__input" type="checkbox" checked>
<span class="check__box"></span>
Второй
</label>
<label class="check option">
<input class="check__input" type="checkbox" disabled>
<span class="check__box"></span>
Третий
</label>
<label class="check option">
<input class="check__input" type="checkbox" checked disabled>
<span class="check__box"></span>
Четвёртый
</label>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment