【问题标题】:Ionic 3 How to change the radio icon of ion-radio color when checked to another one?Ionic 3 如何将 ion-radio 颜色的单选图标更改为另一个?
【发布时间】:2019-10-31 18:40:06
【问题描述】:

我需要更改选中单选图标的颜色。

我将ion-radio的现有样式改为:

ion-radio.radio.radio-checked, ion-radio.radio.radio-md
{
   background-color: white;
}

但这不是必需的。

然后改为:

ion-radio.radio.radio-checked, ion-radio.radio.radio-md
{
   color: white;
}

但还是一样。

我需要将选中变量的蓝色更改为白色。

然后我尝试将radio-innerradio-icon 更改为:

ion-radio.radio.radio-checked, ion-radio.radio.radio-md
, ion-radio.radio.radio-icon, ion-radio.radio-inner{
  background-color: white;
}

但它没有改变。

根据文档,我们应该将以下 css 变量更改为另一种颜色:

--color-checked 

但还是一样。这是stackblitz

【问题讨论】:

    标签: css ionic-framework sass ionic3


    【解决方案1】:

    请试试这个 css 代码:

    .radio-md .radio-checked,
    .radio-md-primary .radio-checked {
      border-color: #fff;
    }
    .radio-md .radio-inner,
    .radio-md-primary .radio-inner {
       background-color: #fff;
    }
    .item-md .radio-md {
       background-color: transparent;
    }
    

    并删除此代码:

    ion-radio.radio.radio-checked, ion-radio.radio.radio-md
    {
       background-color: white;
    }
    

    【讨论】:

    • 添加这个 CSS: .item-md .radio-md { background-color: transparent; }
    猜你喜欢
    • 1970-01-01
    • 2019-04-29
    • 1970-01-01
    • 2021-04-20
    • 2017-11-22
    • 2017-10-19
    • 2019-06-14
    • 2019-06-03
    • 2015-10-24
    相关资源
    最近更新 更多