HTML CSS examples for CSS Selector:element not immediately sibling
CSS Target Selection with + and ~ combinators
<html> <head> <meta name="viewport" content="width=device-width"> <style> .option~.option li.b { background-color:Chartreuse; } </style> <!--from w ww. j av a 2s. co m--> </head> <body> <ul> <div class="option"> <li class="b">Lorem i</li> </div> <div class="option"> <li class="a">Lorem i</li> </div> <div class="option"> <li>Lorem ip</li> </div> <div class="option"> <li class="b">Lorem i</li> </div> <div class="option"> <li class="b">Lorem i</li> </div> </ul> </body> </html>