简体   繁体   English

如何更改离子项的文本颜色

[英]How can I change the text colour of ion-item

I've been struggling to figure out how to change the text colour of ion-item. 我一直在努力弄清楚如何改变离子项的文字颜色。 This is wahat I have so far, i've found how to change the background colour. 这是我到目前为止,我已经找到了如何改变背景颜色。

<ion-item style="background-color: #82B1FF">

But how do I change the text colour? 但是如何更改文字颜色?

CSS style for changing font-color is color . 用于更改字体颜色的CSS样式是color

So you can add: color: #fff; 所以你可以添加: color: #fff; For a white font color, for example. 例如,对于白色字体颜色。

Using Ionic 1, the trick is to use the tag to change the background colour, but then use a div class to inside the to adjust the text colour. 使用Ionic 1,诀窍是使用标签来改变背景颜色,然后使用div类来调整文本颜色。 Like so: 像这样:

    <ion-item style="background-color: #2196F3; color: #E3F2FD">
      <div class="CustomColour">
        <h2><b>{{key}}</b></h2>
      </div>
    </ion-item>

And in the CSS file: 并在CSS文件中:

    div.CustomColour * {
       color: #E3F2FD !important;
    }
<ion-item style="background-color: #82B1FF; color:#fff">hey

that's how you do that and those are the result: 这就是你如何做到这一点,结果是: 在此输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM