复选框美化(去√,复选按钮,图片单选框)

效果图:

在这里插入图片描述

css:
<style type="text/css">
.RadioStyle input{
       display: none;
}
.RadioStyle label{
    border: 1px solid #adadad;
    padding: 2px 10px 2px 5px;
    line-height: 28px;
    min-width: 80px;
    text-align: center;
    float: left;
    margin: 5px;
    border-radius: 5px;
}
.RadioStyle input:checked+label{
    color: white;
    background: #3F949F;
}
.clear{
    clear: both;
}

</style>
HTML代码:
<div class="row cl" >
	<label class="form-label col-xs-4 col-sm-2">可选标签:</label>
	<div class="formControls col-xs-8 col-sm-9 RadioStyle">
		<!-- <c:forEach items="${labels}" var="label" varStatus="stat">
			<input type="checkbox" name="label" value="${label.id }" id="${label.id }" /><label for="${label.id }">${label.name }</label>
		</c:forEach> -->
		<input type="checkbox" name="label" value="" id="bq1" /><label for="bq1">标签6</label>
		<input type="checkbox" name="label" value="" id="bq2" /><label for="bq2">科学大道</label>
		<input type="checkbox" name="label" value="" id="bq3" /><label for="bq3">莲花街</label>
		<input type="checkbox" name="label" value="" id="bq4" /><label for="bq4">公交站附近</label>
		<input type="checkbox" name="label" value="" id="bq5" /><label for="bq5">医院附近</label>
		<input type="checkbox" name="label" value="" id="bq6" /><label for="bq6">学校附近</label>
	</div>
</div>

-------------------------------------------------------更新-----------------------------------------------------------

又做了一个单选框的图片
代码跟上面的差不多,就是改了一下input标签的type为radio
然后修改了一下选中样式

CSS
<style type="text/css">
.col-xs-4 {
    width: 17.7777%;
}

.RadioStyle input{
       display: none;
}
.RadioStyle label{
    border: 1px solid #adadad;
    padding: 2px 10px 2px 5px;
    line-height: 28px;
    min-width: 80px;
    text-align: center;
    float: left;
    margin: 5px;
    border-radius: 5px;
}
/* 就改了这里,改成选中之后添加一个红色的边框 */
.RadioStyle input:checked+label{
    color: white;
    border:2px solid red;
}
.clear{
    clear: both;
}

</style>
HTML:
**<div class="row cl" >
	<label class="form-label col-xs-4 col-sm-2">路口模型:</label>
	<div class="formControls col-xs-8 col-sm-9 RadioStyle">
			<input type="radio" name="model" value="" id="lx1" /><label for="lx1"><img id="" src="${rootPath}/common/resource/images/lx1.png" height="100" width="100"></label>
			<input type="radio" name="model" value="" id="lx2" /><label for="lx2"><img id="" src="${rootPath}/common/resource/images/lx2.png" height="100" width="100"></label>
			<input type="radio" name="model" value="" id="lx3" /><label for="lx3"><img id="" src="${rootPath}/common/resource/images/lx3.png" height="100" width="100"></label>
			<input type="radio" name="model" value="" id="lx4" /><label for="lx4"><img id="" src="${rootPath}/common/resource/images/lx4.png" height="100" width="100"></label>
			<input type="radio" name="model" value="" id="lx5" /><label for="lx5"><img id="" src="${rootPath}/common/resource/images/lx5.png" height="100" width="100"></label>
	</div>
</div>
效果展示:

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

散装程序猿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值