CSS Hierarchy div> table> td> id> class

时间:2022-01-01 20:34:14

I want to target the "order_bar_active" class but I'm not getting the right hierarchy.

我想定位“order_bar_active”类,但我没有得到正确的层次结构。

<div class="order_bar">
<table class="order_bar">
<tbody>
<tr>
<td id="adress_data_bar" class="order_bar_active">
</td></tr></tbody></table></div>

Edit: The class="order_bar_active" is not unique, so I need to define it using the unique id="adress_data_bar".

编辑:class =“order_bar_active”不是唯一的,因此我需要使用唯一的id =“adress_data_bar”来定义它。

EDIT #2: The solution for my specific problem is:

编辑#2:我的具体问题的解决方案是:

table.order_bar #adress_data_bar.order_bar_active {
}

1 个解决方案

#1


3  

In your example the order_bar_active class is the only one of it's kind so you simply need

在您的示例中,order_bar_active类是唯一的类,因此您只需要

.order_bar_active {
  your rules
}

Further to your edit that order_bar_active is not unique, you can append the class name to the unique ID like so:

在您的编辑中,order_bar_active不是唯一的,您可以将类名附加到唯一ID,如下所示:

#address_data_bar.order_bar_active {
  your rules
}

#1


3  

In your example the order_bar_active class is the only one of it's kind so you simply need

在您的示例中,order_bar_active类是唯一的类,因此您只需要

.order_bar_active {
  your rules
}

Further to your edit that order_bar_active is not unique, you can append the class name to the unique ID like so:

在您的编辑中,order_bar_active不是唯一的,您可以将类名附加到唯一ID,如下所示:

#address_data_bar.order_bar_active {
  your rules
}