收藏
回答

自定义radio样式,设置radio背景颜色无效

框架类型 问题类型 API/组件名称 终端类型 操作系统 微信版本 基础库版本
小程序 Bug radio 客户端 6.7.0 1.0.2

重新复写自定义radio选中时的背景颜色无效,但checkbox可以,radio选中时的伪元素before又生效,这是什么原因呢?

/*选中更改背景颜色  无效*/

radio .wx-radio-input.wx-radio-input-checked{


border: none;

background: red;


}



/*选中更改背景颜色  有效*/

checkbox .wx-checkbox-input.wx-checkbox-input-checked{


border: none;

background: red;

}


/* 选中后的更改背景颜色,选中样式   有效/*


radio .wx-radio-input.wx-radio-input-checked::before{


position: absolute;

top: 22rpx;

left: 23rpx;

width: 26rpx;

height: 26rpx;

background: yellow;

border-radius: 50%;

text-align: center;

font-size:0rpx;

transform:translate(-50%, -50%) scale(1);

-webkit-transform:translate(-50%, -50%) scale(1);

}





回答关注问题邀请回答
收藏

1 个回答

  • Mr.木易
    Mr.木易
    2018-07-03

    先看一下类的权重问题

    2018-07-03
    有用 1
    回复 1
    • 峰
      2019-06-13

      就是在background 样式添加权重

      !important

      可以解决,但是checkbox真的木有这个问题

      2019-06-13
      回复
登录 后发表内容