似乎无法定位我的3divs中的最后一个p-tag。我想删除last-child
标记的p
边框。我在这做错了什么:
<div class="box">
<div class="span4">
<p>Some text.</p>
</div>
<div class="span4">
<p>Some text.</p>
</div>
<div class="span4">
<p>Some text.</p>
</div>
</div>
.span4 {
width: 320px;
p {
font-size: 1.2em;
padding: 0 40px;
border-right: 1px #dfdfdf solid;
}
&:last-child {
border: none;
}
}
答案 0 :(得分:6)
您需要使用伪选择器选择p
标记:
.span4 {
width: 320px;
p {
font-size: 1.2em;
padding: 0 40px;
border-right: 1px #dfdfdf solid;
&:last-child {
border: none;
}
}
}
答案 1 :(得分:2)
找到解决方案。由于我想在div中定位单个p-tag,因此解决方案如下:
.span4:last-child p{
border-right: none;
}