单选框、复选框点击添加相应样式(自定义背景图片)

这篇博客介绍了如何在Vue项目中使用JavaScript和CSS实现单选框及复选框的点击效果,通过设置不同的背景图片(雪碧图)展示未选中、选中和鼠标悬停的状态。内容包括CSS样式设置、HTML结构以及JavaScript数据处理,例如`billTypeList`和`billMoneyList`的数据数组,以及`currentBillMoneyIndex`、`isNoWay01`等状态变量。此外,`methods`部分可能包含处理这些组件交互的逻辑。
摘要由CSDN通过智能技术生成

图片是雪碧图(未选中,选中,鼠标移上去的样式)

css:

.billSelectIpt {
    font-size:14px;
    color:rgba(51,51,51,1);
}

.billSelectIpt input[type='radio']+label {
    margin: 4px 5px -2px 0;
    background: url(../images/billRadioIcons.png) 0 0 no-repeat;
    cursor: pointer;
    padding-left: 23px;
    height: 14px;
}
.billSelectIpt input[type='radio']:hover+label {
    background: url(../images/billRadioIcons.png) 0 -24px no-repeat;
    color: #298EF8;
}
.billSelectIpt input[type='radio']:checked:hover+label {
    background: url(../images/billRadioIcons.png) 0 -48px no-repeat;
    color: #298EF8;
}
.billTicketChecked {
    color: #298EF8;
}
.billTicketChecked label{
    background: url(../images/billRadioIcons.png) 0 -48px no-repeat!important;
}
.billSelectIpt input[type='checkbox']+label {
    margin: 4px 5px -2px 0;
    background: url(../images/billCheckboxIcons.png) 0 0 no-repeat;
    cursor: pointer;
    padding-left: 23px;
    height: 14px;
}

.billSelectIpt input[type='checkbox']+label span {
    position: relative;
    top: -4px;
}

.billSelectIpt input[type='checkbox']:hover+label {
    background: url(../images/billCheckboxIcons.png) 0 -
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值