所以这是我的代码:
.tagBoxContent p:first-child {
color: blue;
}
.tagBoxContent p:last-child {
color: red;
}Run Code Online (Sandbox Code Playgroud)
<div class="tagBoxContent">
<a class="tagHeadline">with <span>'chat'</span> tagged articles</a>
<p>Lorem ipsum dolor sit amet,</p>
<p>Integer ma</p>
</div>Run Code Online (Sandbox Code Playgroud)
为什么first-child不会触发p标签但是最后一个子元素呢?如何在没有第一个孩子或有工作的第一个孩子的情况下调用第一个p标签?我研究了很多,但没有找到任何重复相同的问题.