是否可能将图像放在输入类型=“复选框”? [英] is it possible put image in input type="check box"?

查看:73
本文介绍了是否可能将图像放在输入类型=“复选框”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在图像的背景上放置复选框&在我的html代码中的单选框,但它不工作,但它的工作在其他窗体属性。

解决方案

我发现了如何给图像复选框


$ b p $ p> < input type ='checkbox'name ='thing'value ='valuable'id =thing/>< label for =thing>< / label> ;

CSS

  input [type = checkbox] {
display:none;
}

input [type = checkbox] + label {
background:#999;
height:16px;
width:16px;
display:inline-block;
padding:0 0 0 0px;
}

输入[type = checkbox]:checked + label {
background:#0080FF;
height:16px;
width:16px;
display:inline-block;
padding:0 0 0 0px;
}

检查此更多 http://css-tricks.com/the-checkbox-hack/



https://gist.github.com/592332


i want to put an image on the background of check box & radio box in my html code but it's not work but it's work on other form property.

解决方案

I found the way how give image to checkbox & radio button with pure css.

HTML

<input type='checkbox' name='thing' value='valuable' id="thing"/><label for="thing"></label>

CSS

input[type=checkbox] {
    display:none;
}

input[type=checkbox] + label {
    background: #999;
    height: 16px;
    width: 16px;
    display:inline-block;
    padding: 0 0 0 0px;
}

input[type=checkbox]:checked + label {
    background: #0080FF;
    height: 16px;
    width: 16px;
    display:inline-block;
    padding: 0 0 0 0px;
}

Check this for more http://css-tricks.com/the-checkbox-hack/ ,

https://gist.github.com/592332

这篇关于是否可能将图像放在输入类型=“复选框”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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