自定义radio样式,设置radio背景颜色无效
发布于 5 年前 作者 huangwei 18788 次浏览 来自 问答

重新复写自定义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 回复

先看一下类的权重问题

回到顶部