如何选中相同class类名下最后一项?
发布于 6 年前 作者 yeping 14658 次浏览 来自 问答

如题 想给同一个class类名下最后一项的border去掉 请问如何实现

1 回复

你可以试试 .mylast:last-of-type

示例代码:

<style> 
.mylast:last-of-type
{
	background:#ff0000;
}
</style>
<h1>This is a heading</h1>
<div class="mylast">The first paragraph.</div>
<div class="mylast">The second paragraph.</div>
<div class="mylast">The third paragraph.</div>
<div class="mylast">The fourth paragraph.</div>
回到顶部