css - 如何更改 Ionic 4 中 ionic 选择元素的文本颜色?

标签 css ionic-framework

我在 theme/variables.scss 中设置了我的警报样式(黑色背景,白色文本)

ion-alert {
    --background: black !important;
    --color: white !important;

    button {
        color: white !important;
        font-size: 20px !important;
    }
}
<ion-item>
    <ion-label>Quantity</ion-label>
    <ion-select formControlName="quantity" placeholder="Select One">
        <ion-select-option value="1">1</ion-select-option>
        <ion-select-option value="2">2</ion-select-option>
    </ion-select>
</ion-item>

现在的问题是,当我使用 ion-select 添加选择菜单时,单选/选择文本 (ion-select-option) 是黑色的,因此它混合与弹出窗口的背景。我尝试了大约 30 个不同的 CSS 类,但没有一个产生任何影响。

如何更改单选文本的颜色?

最佳答案

想通了。 .sc-ion-alert-md 类将更改单选标签的文本颜色。使用 ionicserve 在 iOS 和 Android 的 Chrome 中进行了测试。

ion-alert.select-alert {
    --background: black!important;

    button {
        color: white !important;
        font-size: 20px !important;
    }

    .sc-ion-alert-md {
        color: white;
    }
}

关于css - 如何更改 Ionic 4 中 ionic 选择元素的文本颜色?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58864120/

相关文章:

javascript - Google map 未显示在 Modal Ionic 中

ionic-framework - 按钮垂直对齐内的 ionic 微调器

angularjs - Ionic/AngularJS base64 图像不会显示

javascript - 使用 angularjs 过滤器显示包含特定 css 类的元素

javascript - Wordpress 图像选择器 - 在主题选项页面中使用

javascript - 选择每个单词并给它另一种颜色

android - 从服务器加载混合 iOS 和 Android 移动应用程序

css - 在 css 中声明带有 "background image"图像的 "height: auto"不显示

css - Firefox 忽略 CSS font-weight 属性

javascript - Web App 在 Webview 内部运行并像 native App 一样安装