請檢查小提琴:http://jsfiddle.net/C23g6/1255/如果我給最後一個元素顯示none,如何選擇最後一個div?
我想最後一個子(7777)上邊框是顯示器無法比擬的。
我試過了,但我不能請給我解決方案。
只有通過CSS
CSS
.common.true{
display: block;
border-top: 1px solid red;
}
.common{
display: none;
}
.true:last-child{
border-top: none;
}
我不希望最後一個子邊界不顯示。但不使用第n個孩子。一些其他的方式
什麼是選擇7777 DIV的原因是什麼?它總是最後一個孩子嗎?或者有沒有一個特定的原因,你不能使用'nth-child()'或'nth-last-child()'? – jbutler483
您正在搜索':last-of-type' http://stackoverflow.com/questions/7298057/css-last-child-selector-select-last-element-of-specific-class-not-last-child -一世 – eMarine