jeudi 5 mars 2020

:checked not working in css with pseudo elements

I am working on project where my html is generated by drupal so I cant modify my Html files.i am stuck at problem where I need to make a customize check box ,though I made a checkbox but I am not able to make a check mark on it.

Here is my code

#login-nav input[type="checkbox"] {
    display: none;
}

#login-nav input[type="checkbox"] label:before {
    padding: 0;
    position: absolute;
}

#login-nav input[type=checkbox]+label:before {
    background-color: #fff;
    border: 1px solid #444;
    content: "";
    font-family: "Arial";
    font-style: normal;
    height: 16px;
    left: 0;
    line-height: 16px;
    margin-right: 0;
    padding-left: 2px;
    position: absolute;
    top: 3px;
    width: 16px;
    font-size: 12px;
}



#login-nav input[type=checkbox]:checked~label::after {
    background-color: rgb(107, 194, 0);
    color: rgb(255, 255, 255);
    content: "✔";
    border-width: 1px;
    border-style: solid;
    border-color: rgb(107, 194, 0);
    border-image: initial;
    position: absolute
}
<form class="form" id="login-nav">
<div class="checkbox">
    <input type="checkbox">
    <label>Remember me</label>
     <a href="en/forgot-password.html" class="omb_forgotPwd pull-right"> Forgot password? </a>
 </div>
 </form>



Aucun commentaire:

Enregistrer un commentaire