div,p:nth-child(2){ color: red; }
div:nth-child(2){ color: red; } p:nth-child(2){ color: red; }
<div id="head"> <h1>标题A</h1> <p>段落A</p> <p>段落B</p> </div> <div id="body"> <h2>标题B</h2> <p>段落A</p> <p>段落B</p> </div>
两个元素选择器,最后实现的效果不相同,能解释一下吗?
学习js
echo_kinchao
woshiajuana
慕的地6079101
YANhan