正常工作,爲什麼文章的行爲不同,以div的,其中最後一個孩子而言最後孩子沒有與文章
HTML
<div class="parent">
<div class="example">111</div>
<div class="example">111</div>
<div class="example">111</div>
<div class="example">111</div>
</div>
<br>
<div class="parent2">
<article class="example">111</div>
<article class="example">111</div>
<article class="example">111</div>
<article class="example">111</div>
</div>
CSS
.parent .example{ background-color: red;}
.parent .example:last-child{background-color: yellow;}
.parent2 .example{ background-color: red;}
.parent2 .example:last-child{background-color: yellow;}
DEMO:http://jsfiddle.net/chLLa/1/
因爲你使用div標籤關閉您的文章標籤?如果您修復這些錯別字,似乎工作正常。 http://jsfiddle.net/j08691/chLLa/2/ – j08691
[Validators](http://validator.nu/)是你的朋友。 – steveax
好的 - 對不起...其實我在我的實際代碼中仍然存在這個問題,所以我會試着重新編寫它 – byronyasgur