Reputation: 15211
Given two long and complex selectors such as
.question-number td:first-child > span[...]
.question-text td:first-child > span[...]
Is there a way to merge the two such that the long suffix does not need to be repeated? Something like (though this is not valid CSS)
(.question-number | .question-text) td:first-child > span[...]
Upvotes: 0
Views: 58
Reputation: 272592
In case you only have those two classes that contains the word question you can consider attribute selector like below:
[class*=question] td:first-child>span {
color: red;
}
<table>
<tr class="anoher-class">
<td><span>some text</span></td>
</tr>
<tr class="question-number">
<td><span>some text</span></td>
</tr>
<tr>
<td><span>some text</span></td>
</tr>
<tr class="question-text">
<td><span>some text</span></td>
</tr>
</table>
Upvotes: 1