【问题标题】:To highlight list-item text-color突出显示列表项文本颜色
【发布时间】:2018-11-28 04:09:23
【问题描述】:

我有两个名为 listdetails 的组件,我将它们放在另一个名为 customer 的组件中,如下所示:

场景: 默认情况下,第一个列表项(即 customer-one)被选中意味着它的 background-color 突出显示,如图所示。当我单击下一个项目时(比如 custome -two) 该项目将被突出显示。

这里的问题是:我也想突出显示text-color ..:) 我尝试给例如:(color:red!important;)。还是没有结果。

这里是堆栈闪电战link

【问题讨论】:

  • 请在此处也包含代码
  • 由于组件更多,我已提供stackblitz 链接。 @Justcode

标签: angular angular-material angular6


【解决方案1】:

试试这个

.selected span{
          color:red!important;
    }

【讨论】:

    【解决方案2】:
    .selected span{
        color:red!important;
    }
    

    这肯定会起作用,因为文本在跨度内。

    【讨论】:

    • 你不需要申请!important,没有它也可以。
    【解决方案3】:

    您的答案之前已解决,但您应该尽量不要使用 !important。 这是没有 !important 标志的代码:

    .selected span{
              color:red;
        }
    

    【讨论】:

      猜你喜欢
      • 2016-03-29
      • 2010-10-18
      • 1970-01-01
      • 2013-04-22
      • 2011-03-24
      • 1970-01-01
      • 2015-04-25
      • 2018-10-02
      • 2012-04-25
      相关资源
      最近更新 更多