Сначала вы должны скрыть флажок по умолчанию:
[type="checkbox"] {
display: none
}
Затем установите общий стиль для label:after
:
[type="checkbox"]+label:after {
content: '';
position: absolute;
...
}
Затем введите :checked
состояние
[type="checkbox"]:checked+label:after {
content: '✔';
}
А также установите метку так, чтобы она правильно отображалась в середине вашего пользовательского флажка.Ваша отметка была за пределами коробки.
input[type="checkbox"] {
transform: scale(3, 3) !important;
margin: 0px 21px;
}
.checkbox-custom,
.checkbox-custom-label {
display: inline-block;
vertical-align: middle;
margin: 5px 7px;
cursor: pointer;
font-size: 2.4rem;
font-family: "FuturaPT_BOOK";
/* padding: 6px; */
}
[type="checkbox"] {
display: none
}
[type="checkbox"]+label:after {
content: '';
position: absolute;
top: 31px;
left: 23px;
font-size: 24px;
line-height: 0.8;
color: #fff;
transition: all .2s;
}
[type="checkbox"]:checked+label:after {
content: '✔';
}
.checkbox-custom+.checkbox-custom-label:before {
content: '';
background: #fff;
border: 1px solid #000;
display: inline-block;
vertical-align: text-top;
width: 30px;
height: 30px;
padding: 2px;
margin-right: 30px;
text-align: center;
border-radius: 24%;
}
.checkbox-custom:checked+.checkbox-custom-label:before {
background: #000;
box-shadow: inset 0px 0px 0px 4px #fff;
}
<p class="checkbox">
<input type="checkbox" class="checkbox checkbox-custom" name="cgv" id="cgv" value="1" />
<label class="checkbox-custom-label" for="cgv">I agree to the terms of service</label>
<a href="{$link_conditions|escape:'html':'UTF-8'}" class="iframe" rel="nofollow">Read the Terms of Service</a>
</p>