Stylized checkbox in Bootstrap does not work

1

Good afternoon, I stylized a checkbox group. Only clicking it is not checked. I followed all the steps to make the change and even then I can not leave it selected. Could someone see my code in codePen and tell me where I might be going wrong?

form.asp

<div class="form-group">
<div class="checkbox-nice">          
<input class="checkbox-nice"  type="checkbox" name="recursos" id="recursos" value="Chat Interno">
<label for="Chat Interno"> Chat Interno </label>
</div>
<div class="checkbox-nice">
<input class="form-check-input" type="checkbox" name="recursos" id="recursos" value="Confirmação Automatica por SMS">
<label class="form-check-label"> Confirmação Automática por SMS </label>
</div>
<div class="checkbox-nice"><input class="form-check-input" type="checkbox" name="recursos" id="recursos" value="App  para Android">
<label class="form-check-label"> App  para Android </label>
</div>
<div class="checkbox-nice">
<input class="form-check-input" type="checkbox" name="recursos" id="recursos" value="Relatorios com Graficos">
<label class="form-check-label"> Relatórios com Gráficos </label>
</div>
<div class="checkbox-nice">
<input class="form-check-input" type="checkbox" name="recursos" id="recursos" value="Envio de E-mail pelo Sistema">
<label class="form-check-label"> Envio de E-mail pelo Sistema </label>
</div></div>

checkbox css

.checkbox-nice {
    position: relative;
    padding-left: 15px;

}
.checkbox-nice input[type=checkbox] {
    visibility: hidden;
}
.checkbox-nice label {
    padding-top: 3px;
}
.checkbox-nice.checkbox-inline>label {
    margin-left: 16px;
}
.checkbox-nice label:before {
    cursor: pointer;
    position: absolute;
    width: 22px;
    height: 22px;
    left: 1px;
    top: 1px;
    background: #ffffff;
    content: "";
    border: 1px solid #a62b32;
    border-radius: 3px;
    background-clip: padding-box;
}
.checkbox-nice label:after {
    opacity: 0;
    content: '';
    position: absolute;
    width: 12px;
    height: 7px;
    background: transparent;
    top: 7px;
    left: 6px;
    border: 3px solid #a62b32;
    border-top: none;
    border-right: none;
    -webkit-transform: rotate(-45deg);
    -ms-transform: rotate(-45deg);
    transform: rotate(-45deg);
}
.checkbox-nice label:hover::after {
    opacity: 0.3;
}
.checkbox-nice input[type=checkbox]:checked+label:after {
    opacity: 1;
}

Thank you so much! Code html and css in codepen

    
asked by anonymous 18.12.2016 / 18:47

1 answer

2

Use for="input_id" in label

<input class="checkbox-nice"  type="checkbox" name="recursos" id="recursos-1" value="Chat Interno" checked>
<label for="recursos-1"> Chat Interno </label>
    
18.12.2016 / 18:54