请选择支付方式
当前位置:   article > 正文

css修改单选按钮样式_css更改单选按钮选中样式

css更改单选按钮选中样式

功能需要选择支付方式—css实现选中单选按钮样式切换

如图所示
order

上代码

// 代码片段为选择支付方式模块
// 原生效果
		<div class="order-pay pd border">
            <div class="label">请选择支付方式</div>
            <div class="item">
                <input class="check" type="radio" id="wx" name="item" value="选项一"/>
                <div class="check-back"></div>
                <label for="wx">
                    <div class="img"><img src="./img/weixin.png" alt=""></div>
                    <div class="method">微信支付</div>
                </label>
            </div>
            <div class="item">
                <input class="check" type="radio" id="zfb" name="item" value="选项二"/>
                <div class="check-back"></div>
                <label for="zfb">
                    <div class="img"><img src="./img/zfb.png" alt=""></div>
                    <div class="method">支付宝支付</div>
                </label>
            </div>
        </div>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
/* rem为移动端单位 */
/* order-pay */
.order-pay{
    padding: .3rem .2rem;
}
.order-pay .label{
    color: #808080;
}
.order-pay .item{
    position: relative;
    height: 1rem;
    line-height: 1rem;
    text-align: center;
    display: flex;
}
.order-pay .item input{
    width: .4rem;
    height: .4rem;
    margin-top: .35rem;
}
.order-pay .img{
    margin: 0 .2rem;
}
.order-pay img{
    width: .4rem;
    height: .4rem;
    vertical-align: middle;
}
.order-pay label{
    height: 1rem;
    line-height: 1rem;
    width: 100%;
    display: flex;
    margin-left: .45rem;
}
.order-pay .method{
    color: #666666;
}
.check{
    width: .4rem;
    height: .4rem;
    position: absolute;
    opacity: 0;
    z-index: 3;
}
.check-back{
    width:.4rem;
    height:.4rem;
    position: absolute;
    background: url("./img/check.png");
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 2;
    top: .35rem;
}
.item input:checked + .check-back{
    background: url("./img/checked.png");
    background-size: contain;
    background-repeat: no-repeat;
}
.pay-btn{
    width:6.8rem;
    height:1rem;
    line-height: 1rem;
    text-align: center;
    background:rgba(233,86,26,1);
    color: #fff;
    border-radius:8px;
    margin: .2rem auto;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小丑西瓜9/article/detail/297147
推荐阅读
相关标签