<h1 id="h1-u4E0Au4E0Bu6587u9009u62E9u5668"><a name="上下文选择器" class="reference-link"></a><span class="header-link octicon octicon-link"></span>上下文选择器</h1><ol> <li>父子: <code>></code> (仅限父子)<br><img src="https://img.php.cn/upload/image/882/139/377/1678879485282518.png" alt=""><br><img src="https://img.php.cn/upload/image/150/120/935/1678879596462403.png" alt=""><br><img src="https://img.php.cn/upload/image/748/487/824/1678879497808048.png" alt=""></li><li>后代: <code>空格</code> (后级所有元素,包括子集,孙子,重孙…)<br><img src="https://img.php.cn/upload/image/644/407/177/1678879607518755.png" alt=""><br><img src="https://img.php.cn/upload/image/322/419/873/1678879540907381.png" alt=""></li><li>兄弟: <code>+</code> (相邻的下一个元素,紧跟的且只有一个)<br><img src="https://img.php.cn/upload/image/705/816/931/1678879718160208.png" alt=""><br><img src="https://img.php.cn/upload/image/609/797/289/1678879727500294.png" alt=""></li><li>同级: <code>~</code>(与当前元素同级的后面的全部元素)<br><img src="https://img.php.cn/upload/image/981/762/181/1678879738765133.png" alt=""><br><img src="https://img.php.cn/upload/image/434/491/552/1678879748339076.png" alt=""></li></ol>