【问题标题】:selecting a class with a certain child class选择具有特定子类的类
【发布时间】:2021-12-30 12:31:55
【问题描述】:

我有两个同名的父类,但一个有额外的子类。我只想从具有附加子类的父类中选择一个子类。

class = money-styling
     class = compare-at-price
     class = money

class = money-styling
      class = money

我想选择具有同级价格比较的货币类。我唯一能写的代码是"

.money-styling .money{
    color:#ff0000;
}

我该怎么做?

【问题讨论】:

  • 例如:.money-styling .compare-at-price + .money
  • 能否给我们看一些 HTML,因为它取决于彼此之间的位置关系 - 我不确定什么是“子类”。

标签: html css css-selectors scss-mixins


【解决方案1】:
use this one 

.money-styling .compare-at-price ~ .money{
   color:red;
}

【讨论】:

    猜你喜欢
    • 2023-03-17
    • 2013-06-18
    • 2012-09-18
    • 1970-01-01
    • 2018-05-19
    • 1970-01-01
    • 2022-07-27
    • 2023-03-04
    相关资源
    最近更新 更多