微信小程序-checkbox默认样式修改

微信小程序有提供了CSS属性,你可以在文档或者小程序debug看下

1、未选中的背景样式:wx-checkbox-input
2、选中后的背景样式 : wx-checkbox-input.wx-checkbox-input-checked
3、选中后的勾子的样式:wx-checkbox-input.wx-checkbox-input-checked::before

/* 未选中的背景样式 */
checkbox .wx-checkbox-input{
  width: 40rpx; 
  height: 40rpx; 
  border-radius: 50%;
}

/* 选中后的背景样式 */
checkbox .wx-checkbox-input.wx-checkbox-input-checked{
  border: none;
  background: #37C674;
}

/* 选中后的勾子样式 */
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before{
  width: 40rpx;
  height: 40rpx;
  line-height: 40rpx;
  border-radius: 50%;
  text-align: center;
  font-size:32rpx; 
  color:#FFF; 
  background: transparent;
  transform:translate(-50%, -50%) scale(1);
  -webkit-transform:translate(-50%, -50%) scale(1);
}

disabled 样式 .wx-checkbox-input-disabled

.checkbox .wx-checkbox-input.wx-checkbox-input-disabled {
    border: none;
    background: #f3b19a;
}

**

radio样式修改:

**

radio .wx-radio-input {
  margin-right: 15rpx ;
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  background: none;
  border-radius: 6rpx;
  box-sizing: border-box;
}

radio .wx-radio-input.wx-radio-input-checked {
  background-color: transparent;
  border-color: #2cc078;
  overflow: hidden;
  box-sizing: border-box;
}

radio .wx-radio-input.wx-radio-input-checked::before {
  content: url(http://www.lutao.com/front/images2014/common/tick.svg);
  background-size: 20rpx 20rpx;
  font-family: "iconfont" !important;
  font-size: 10rpx;
  color: #2cc078;
  top: auto;
  left: auto;
  right: -4rpx;
  bottom: -4rpx;
  transform: translate(0, 0) scale(1);
  -webkit-transform: translate(0, 0) scale(1);
}
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值