<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
을 선택하고 싶습니까? commentList 실제 마지막 자식 같은 다른 div.something
을 한 내가 할대로 작동하지 않습니다CSS 마지막 자식 선택기 : 부모 클래스의 마지막 자식 요소가 아닌 특정 클래스의 마지막 요소를 선택 하시겠습니까?
.comment {
width:470px;
border-bottom:1px dotted #f0f0f0;
margin-bottom:10px;
}
.comment:last-child {
border-bottom:none;
margin-bottom:0;
}
. 이 경우 마지막 자식 선택기를 사용하여 마지막 모양을 article.comment
으로 선택할 수 있습니까? 문제의 요소가 컨테이너의 마지막 자식 요소의 특정 유형의 마지막이 아닌 경우
그것은 클래스에 보이지 않는하지만, 단지 유형을, 당신은거야 같은 클래스가 아닌 기사가하는 일이 그래서 만약 예상치 못한 결과가 발생합니다. – BoltClock
사실, 여기에 나와 있습니다. http://jsfiddle.net/YmMZZ/1/ – Chris
제대로 작동합니다. 그러나 클래스별로 요소를 좁혀 야하는 경우에는 다시 작동하지 않습니다. http://jsfiddle.net/aliemreeee/a4H7f/2/ –