我的目标是每一行有四列我使用:nth-child
但不能正常工作,因为我预计只能在第一行工作,第二行边界div在第三列。< / p>
HTML
<div class="workplace">some text here</div>
<div class="workplace">some text here</div>
<div class="workplace">some text here</div>
<div class="workplace">some text here</div>
<div class="workplace">some text here</div>
<div class="workplace">some text here</div>
<div class="workplace">some text here</div>
<div class="workplace">some text here</div>
<div class="workplace">some text here</div>
css
.workplace:nth-child(4n){
border:1px solid red;
}
我的问题是:为什么会发生这种情况是因为其他风格的冲突?