我想使用css更改复选框的背景图像 [英] I want to change the background image of check box using css

查看:77
本文介绍了我想使用css更改复选框的背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我的css低于css,我想将背景图片应用于复选框。



Hi,

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

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.

推荐答案

我认为问题出在您的html上,请确保标签指向复选框,例如

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


这篇关于我想使用css更改复选框的背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆