Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am having below css and I want to apply background image to check box.

C#
input[type="checkbox"] {
    position:absolute;
    clip: rect(0,0,0,0);
    clip: rect(0 0 0 0);
}


input[type="checkbox"] + label::before {
    content: url("/Style%20Library/Images/cbox.png");
    /* z-index: -999; */
    /* opacity: 1; */
}


input[type="checkbox"]:checked + label::before {
    content: url("/Style%20Library/Images/cbox1.png");

}



But When I am tried to check box it does not allow me.
Please let me what is missing, I am tried it since morning.

Thanks.
Posted

1 solution

I think the problem is with your html, make sure the label is pointing to the checkbox, e.g.
XML
<input type="checkbox" id="chk">
<label for="chk">Male</label>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900