Webkit Checkboxes & Radio-Button

User appearance for webkit-checkboxes

by denvdmj

HTML

<h1>Webkit Checkboxes &amp; Radio-Button
Customized Appearance</h1>
<form unselectable>

  <fieldset>
    <legend>Чекбоксы</legend>
    <input type="checkbox" id="chbox1" checked /><label for="chbox1">Checkbox 1</label><br/>
    <input type="checkbox" id="chbox2" /><label for="chbox2">Checkbox 2</label><br/>
    <input type="checkbox" id="chbox3" /><label for="chbox3">Checkbox 3</label><br/>
  </fieldset>

  <fieldset>
    <legend>Радиокнопки A</legend>
    <input type="radio" name="radioA" id="radioA1" /><label for="radioA1">Group radioA - radio 1</label><br/>
    <input type="radio" name="radioA" id="radioA2" /><label for="radioA2">Group radioA - radio 2</label><br/>
    <input type="radio" name="radioA" id="radioA3" checked /><label for="radioA3">Group radioA - radio 3</label><br/>
  </fieldset>

  <fieldset>
    <legend>Радиокнопки B</legend>
    <input type="radio" name="radioB" id="radioB1" /><label for="radioB1">Group radioB - radio 1</label><br/>
    <input type="radio" name="radioB" id="radioB2" checked /><label for="radioB2">Group radioB - radio 2</label><br/>
    <input type="radio" name="radioB" id="radioB3" /><label for="radioB3">Group radioB - radio 3</label><br/>
  </fieldset>

  <fieldset>
    <legend>Радиокнопки C</legend>
    <input type="radio" name="ir-help-src" id="ir-help-src-en" data-value="http://en.site.com/help/" checked="1" />
      <label for="ir-help-src-en">Английская справка</label><br/>
    <input type="radio" name="ir-help-src" id="ir-help-src-ru" data-value="http://ru.site.com/help/" />
      <label for="ir-help-src-ru">Русская справка</label><br/>
    <input type="radio" name="ir-help-src" id="ir-help-src-custom" />
      <label for="ir-help-src-custom">Другая</label>
      <input type="text" id="user-help-source" value="http://" data-disabled="#ir-help-src-custom" /><br/>
  </fieldset>
</form>

<p>Customizing checkboxes &amp; radiobuttons with CSS label:after &amp; label:before w/o images &amp; background-images</p>
<p>A Pen...

CSS

:root {
 font: 14px/1.4 sans-serif;
}

body {
 padding: 1em 2em;
 margin: auto;
 min-width: 200px;
 max-width: 500px;
 text-align: left;
 background: #fff;
}

h1 {
  text-align: center;
}

input, label {
  position: relative;
  display: inline-block;
  margin: 2px 0;
}

label {
  padding: 2px;
  position: relative;
}

input[type="checkbox"],
input[type="radio"] {
 -webkit-appearance: none;
  appearance: none;
  border: .5px solid #999;
  margin: 0;
  outline: none;
  overflow: hidden;
  background: linear-gradient(0deg, rgba(10,10,10,.2),rgba(0,0,0,0));
}
input[type="checkbox"], input[type="checkbox"]::after,
input[type="radio"], input[type="radio"]::after {
  width: 18px;
  height: 18px;
  border-radius: 9px;
}
input[type="checkbox"] {
  border-radius: 2px;
}
input[type="checkbox"]:checked::after {
  content: "✓";
  display: table-cell;
  text-align: center;
  vertical-align: middle;
  font: bold 15px/1 Verdana;
}
input[type="radio"]:checked::after {
  content: "";
  display: inline-block;
  margin: 3.5px 0 0 3.5px;
  width: 10px;
  height: 10px;
  background: linear-gradient(-45deg, #000, #ccc);
  border-radius: 10px;
}

input[type="checkbox"] + label,
input[type="radio"] + label {
  display: inline-block;
  margin-left: .3em;
  vertical-align: 20%;
}

input[type="radio"]:not(:checked) + label + input[type="text"] {
  opacity: .4;
}

input[type="checkbox"]:focus + label,
input[type="radio"]:focus + label {
  outline: 1px dotted #aaa;
}

/*************************/

fieldset {
  border-radius: 5px;
  border: 1px solid #000;
  margin-bottom: 10px;
}

/*************************/

input[type="button"], button, label, [unselectable] {
  user-select: none;
 -moz-user-select: -moz-none;
 -webkit-user-select: none;
 -ms-user-select: none;
 -webkit-user-modify: read-only;
  cursor: default;
}

/*************************/

::-webkit-scrollbar {
  width: 14px;
  height: 14px;
  background: transparent;
}
::-webkit-scrollbar-thumb:vertical {
  background:...