运行 ❯
获取您
的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <style> section { padding: 10px; margin: 10px; border: 1px solid black; background-color: lightgray; } /* Select section elements that have an h1 element inside */ section:has(h1) { background-color: gold; } /* Select section elements that have an element with class 'funfact' inside */ section:has(.funfact) { color: blue; } </style> </head> <body> <h1>Demo of :has()</h1> <section> <h1>WWF</h1> <p>The World Wide Fund for Nature (WWF) is an international organization working on issues regarding the conservation, research and restoration of the environment, formerly named the World Wildlife Fund. WWF was founded in 1961.</p> </section> <section> <h2>WWF's Panda symbol</h2> <p class="funfact">The Panda has become the symbol of WWF. The well-known panda logo of WWF originated from a panda named Chi Chi that was transferred from the Beijing Zoo to the London Zoo in the same year of the establishment of WWF.</p> </section> <section> <h2>WWF Now</h2> <p>The first three national appeals (now called national organizations) were also established in 1961 in the United Kingdom, Switzerland, and the United States. Since then, WWF-US has grown to include over 1 million supporters and has helped lead conservation projects in Alaska, the Northern Great Plains, and around the world.</p> </section> </body> </html>