Skip to content

Instantly share code, notes, and snippets.

@karamanskiy
Created July 25, 2018 20:02
Show Gist options
  • Save karamanskiy/a7cc74fc1569b0daef37738e0daafda2 to your computer and use it in GitHub Desktop.
Save karamanskiy/a7cc74fc1569b0daef37738e0daafda2 to your computer and use it in GitHub Desktop.
Стилизированный radiobutton
<!-- HTML -->
<label>
<input class="radio" type="radio" name="radio-test">
<span class="radio-custom"></span>
<span class="label">Lorem ipsum dolor sit amet, consectetur</span>
</label>
<!-- CSS -->
.radio {
display: none;
}
.radio-custom {
width: 20px;
height: 20px;
border: 2px solid #ccc;
border-radius: 3px;
position: relative;
}
.radio-custom,
.label {
display: inline-block;
vertical-align: middle;
}
.radio:checked + .radio-custom::before {
content: "";
display: block;
position: absolute;
top: 2px;
right: 2px;
bottom: 2px;
left: 2px;
background: #413548;
border-radius: 2px;
}
.radio-custom,
.radio:checked + .radio-custom::before {
border-radius: 50%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment