CSS规则仅在2个类共存时匹配

时间:2013-03-19 17:07:54

标签: html css

我正在寻找只有在有两个班级时才会发生的事情。

例如:

.positive{
  color:#46a546;
}
.positive:after{
  content: "\25b2";
}
.negative{
    color:#F00;
}

.arrow:after{
  content: "\25bc";
}

<span class="positive"> hi </span>
<span class="positiveArrow"> hi </span> 
<span class="negativeArrow"> hi </span> //what i have

<span class="positive arrow"> hi </span>
<span class="negative arrow"> hi </span> // what i want

1 个答案:

答案 0 :(得分:3)

CSS:

.negative.arrow {
    /* Apply your CSS rules here */
}

.positive.arrow {
    /* Apply your CSS rules here */
}