<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>其他选择器</title> <style> /* /!*相邻选择器*!/ #li2+li{ color: red; } */ /* /!*兄弟选择器*!/ #li2~li{ color: red; } */ /*去除效果*/ li:not(:last-child){ border-bottom: 1px solid red; } </style> </head> <body> <ul> <li>1</li> <li id="li2">2</li> <li>3</li> <li>4</li> </ul> </body> </html>
去除效果:去除的那一栏没有效果
兄弟选择器:改变的是标签后面的所有元素
相邻选择器:改变的是标签后面的第一个元素