【发布时间】:2011-11-10 00:21:39
【问题描述】:
<div class="commentList">
<article class="comment " id="com21"></article>
<article class="comment " id="com20"></article>
<article class="comment " id="com19"></article>
<div class="something"> hello </div>
</div>
我要选择#com19?
.comment {
width:470px;
border-bottom:1px dotted #f0f0f0;
margin-bottom:10px;
}
.comment:last-child {
border-bottom:none;
margin-bottom:0;
}
只要我确实有另一个div.something 作为commentList 中的实际最后一个孩子,这就行不通了。在这种情况下是否可以使用last-child选择器来选择article.comment的最后一次出现?
【问题讨论】:
标签: html css css-selectors