jeudi 14 mai 2020

Label on the same line than the checkbox

i cant put the label in the same line than the checkbox.
I dont see how to manage the width of the label i am so blind i guess (or worse) ...
thanks all

The HTML:

<div class=case_choix_checkbox>
<input type="checkbox" name="rgpd" class=classe_checkbox id="rgpd" value=1>
<label for="rgpd">AAAAAAAAAA  BBBBB</label>
</div>

The CSS:

.case_choix_checkbox{
    height:200px;
    width:200px;
}

input[type="checkbox"].classe_checkbox {
  display: none;
}
input[type="checkbox"].classe_checkbox + label {
  box-sizing: border-box;
  display: inline-block;
  width: 3rem;
  height: 1.5rem;
  border-radius: 1.5rem;
  padding:2px;
  background-color: #c0ceda ;
  transition: all 0.5s ;
}
input[type="checkbox"].classe_checkbox + label::before {
  box-sizing: border-box;
  display: block;
  content: "";
  height: calc(1.5rem - 4px);
  width: calc(1.5rem - 4px);
  border-radius: 50%;
  background-color: #fff;
  transition: all 0.5s ;
}
input[type="checkbox"].classe_checkbox:checked + label {
  background-color: #00B7E8 ;
}
input[type="checkbox"].classe_checkbox:checked + label::before {
  margin-left: 1.5rem ;
}

jsfiddle




Aucun commentaire:

Enregistrer un commentaire