带自定义图像的复选框 [英] Checkbox with custom image
本文介绍了带自定义图像的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
根据我上一个问题,具有自定义图片的单选按钮,
使用:
CSS
[type = radio] {
position:relative;
margin:40px
}
[type = radio]:before {
content:'';
position:absolute;
left:-15px;
top:-15px;
width:32px;
height:32px;
background:red
}
[type = radio]:checked:before {
background:green
}
HTML
< input type = radio name = radio />。
< input type = radio name = radio />
< input type = radio name = radio />
解决方案
试试
[type = checkbox] {position:relative; margin:40px} [type = checkbox]:before {content:''; position:absolute; left:-15px; top:-15px; width:32px; height:32px; background:red} [type = checkbox]:checked:before {background:green}
< input type = checkbox name = radio />< input type = checkbox name = radio />< input type = checkbox name = radio />
/ pre>
Based on my last question Radio button with custom image,
requesting a solution for custom checkboxes using :before
Solution accepted from @Tambo is as follows. Need customization to be used with checkboxes on the same solution pattern (smart and concise). Thanks.
CSS
[type=radio]{
position: relative;
margin: 40px
}
[type=radio]:before{
content: '';
position: absolute;
left: -15px;
top: -15px;
width: 32px;
height: 32px;
background: red
}
[type=radio]:checked:before{
background: green
}
HTML
<input type=radio name=radio />
<input type=radio name=radio />
<input type=radio name=radio />
解决方案
try this
[type=checkbox]{
position: relative;
margin: 40px
}
[type=checkbox]:before{
content: '';
position: absolute;
left: -15px;
top: -15px;
width: 32px;
height: 32px;
background: red
}
[type=checkbox]:checked:before{
background: green
}
<input type=checkbox name=radio />
<input type=checkbox name=radio />
<input type=checkbox name=radio />
这篇关于带自定义图像的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文