运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
转到 Spaces
<!DOCTYPE html> <html> <head> <style> .container { background-color: tomato; color: white; padding: 20px; } </style> </head> <body> <p id="myElement" class="container"></p> <script> var element = document.getElementById("myElement"); if (element.matches(".container, .wrapper")) { element.innerHTML = "This element matches either the \".container\" CSS selector or the \".wrapper\" selector."; } else { element.innerHTML = "This element does not match any of the selectors."; } </script> </body> </html>