css3实现对radio和checkbox的美化

一,如何隐藏小程序中的很粗的滚动条,实现页面的美化?
 
tit: 在开发小程序的过程中,无论是横向或者纵向当产生滚动条时,系统默认的滚动条会很粗,效果展示十分难看,我们可以通过设置如下wxss代码实现滚动条的美化。
 
方法一:
::-webkit-scrollbar {
    display:none;
}
 
方法二:
::-webkit-scrollbar {
    width: 0;
    height: 0;
    color: transparent;
}

 

二,如何改变小程序单选/复选框的样式?
 
tit:  在开发时,很多情况下我们需要使用单选/复选框,但是我们发现单选复选框的样式并不是我们想要的样式,我们可以通过如下设置实现wxss自定义单选/复选样式的修改。
 
radio:
/* 未选中的背景样式*/
radio .wx-radio-input {
    width: 40rpx;
    height: 40rpx;
    border-radius: 50%;
}
/* 选中后的背景样式*/
radio .wx-radio-input.wx-radio-input-checked {
    background-color: #16cc80;
}
radio .wx-radio-input.wx-radio-input-checked::before {
    width: 40rpx;
    height: 40rpx;
    border-radius: 50%;
    text-align: center;
    line-height:  40rpx;
    font-size:  30rpx;
    color: #fff;
    background-color: transparent;
    transform: translate(-50%,-50%) scale(1);
    -webkit-transform: translate(-50%,-50%) scale(1);
}

checkbox:

/* 未选中的背景样式*/
checkbox .wx-checkbox-input {
    width: 40rpx;
    height: 40rpx;
    border-radius: 50%;
}
/* 选中后的背景样式*/
checkbox .wx-checkbox-input.wx-checkbox-input-checked {
    background-color: #16cc80;
}
/*选中状态对勾的样式*/
checkbox .wx-checkbox-input.wx-checkbox-input-checked::before {
    width: 40rpx;
    height: 40rpx;
    border-radius: 50%;
    text-align: center;
    line-height:  40rpx;
    font-size:  30rpx;
    color: #fff;
    background-color: transparent;
    transform: translate(-50%,-50%) scale(1);
    -webkit-transform: translate(-50%,-50%) scale(1);
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值