这仅在CSS中可行吗?我无权访问HTML或JS。我需要选择第二个匹配的选择器,而不是元素。
此操作在页面中重复了两次,但我找不到仅更改第二个元素的样式的方法。
.testimonials .testimonials-content .cover-component-slide{
/* Change the second one */
}
答案 0 :(得分:0)
尝试一下:
.testimonials:nth-child(2) .testimonials-content .cover-component-slide{
......
}
或
.testimonials .testimonials-content .cover-component-slide:nth-child(2){
......
}
答案 1 :(得分:0)
.msg:nth-of-type(2) {
color: red;
}
<h1 class="msg">Hello World One</h1>
<h1 class="msg">Hello World Two</h1>