使用元素 ~ 元素选择器选择 ff6d136ddc5fdfeffaf53ff6ee95f185 元素,前面是 e388a4556c0f65e1904146cc1a846bee 元素。您可以尝试运行以下代码来实现此示例
示例实时演示
<!doctype html><html> <head> <style> p~ul { color: white; background-color: blue; } </style> </head> <body> <h1>demo website</h1> <h2>fruits</h2> <div> <p>vegetables are good for health.</p> <ul> <li>spinach</li> <li>onion</li> <li>capsicum</li> </ul> </div> <p>fruits are good for health.</p> <ul> <li>apple</li> <li>orange</li> <li>kiwi</li> </ul> </body></html>
以上就是选择前面有 css 元素的每个元素的详细内容。