Radio button ou Checkbox personalizados com CSS

/* Radio button */
input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    font: inherit;
    color: red;
    width: 1.15em;
    height: 1.15em;
    border: 0.15em solid red;
    border-radius: 50%;
    transform: translateY(0.25em);
    display: grid;
    place-content: center;
}

input[type="radio"]::before {
  content: "";
  width: 0.65em;
  height: 0.65em;
  border-radius: 50%;
  transform: scale(0);
  transition: 120ms transform ease-in-out;
  box-shadow: inset 1em 1em red;
  display: block;
}

input[type="radio"]:checked::before {
    transform: scale(1);
}

/* Checkbox */
input[type="checkbox"] {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
    font: inherit;
    color: red;
    width: 1.25em;
    height: 1.25em;
    border: 2px solid red;
    place-content: center;
}

input[type="checkbox"]::before {
  content: url('data:image/svg+xml,<svg width="10" height="8" viewBox="0 0 10 8"  xmlns="http://www.w3.org/2000/svg"><path d="M9.41406 1.41406L3.5166 7.31152L0 3.79492L1.41406 2.38086L3.5166 4.4834L8 0L9.41406 1.41406Z" fill="%23DC8863"/></svg>');
  width: 14px;
  height: 14px;
  transform: scale(0);
  transition: .12s transform ease-in-out;
  display: grid;
  place-content: center;
}

input[type="checkbox"]:checked::before {
    transform: scale(1);
}

input[type="checkbox"]:checked .elementor-field-group {
    border-color: red;
}

Compartilhar:

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *