This selector can match elements immediately adjacent to the specified element.
E + F
The above code is the format for creating a sibling selector.
E + F Adjacent sibling selector Selects the element that matches F, and this element is the adjacent position behind the matched E element.
E and F must have the same parent element, and F must be behind and adjacent to E. The code example is as follows:
<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://ask.php.cn/" /> <title>php中文网</title> <style type="text/css"> li{color:blue} .antzone+li{ color:red; } </style> </head> <body> <ul> <li>php中文网一</li> <li class="antzone">php中文网二</li> <li>php中文网三</li> <li>php中文网四</li> </ul> </body> </html>
The above code can antzone the font of the immediately adjacent li element. The color is set to red.
Next Section