jeudi 22 juin 2017

CSS Checkboxes, how to deal with required

I am swapping browser checkboxes for my own using this HTML

<input required  type="checkbox" id="acceptance"   name="acceptance" value="yes"><label for="acceptance"></label>

and this CSS

input[type="checkbox"],
input[type="radio"]  {
 display: none;
 width: 30px;
 & + label {
 width: 30px;
 &::before {
  display: inline-block;
  width: 30px;
  height: 26px;
  margin: 0px;
  vertical-align: middle;
  background: url(../images/tick.png) -30px top no-repeat;
  cursor: pointer;
  content: "";
  }
 }
 &:checked  + label::before {
  background: url(../images/tick.png) left top no-repeat;
 }
}

How do I deal with the required in the CSS when the user submits the form without checking this box?




Aucun commentaire:

Enregistrer un commentaire