我需要选择class以特定值开头的last-child元素。让我们假设我有下一个html结构元素:
<div class="wrapper">
<div class="test-1">this is test-1</div>
<div class="test-2">this is test-2</div>
<div class="test-3">this is test-3</div>
<div class="test-4">this is test-4</div>
<div class="another-test">this is the another test</div>
</div>
&#13;
所以,我想用 class =&#34; test-4&#34; 选择 div 。我使用下一个SCSS代码,但它无法正常工作。
div.wrapper div[class^="test"]:last-child {
background-color: red;
}
&#13;