运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <style> #myDIV { width: 500px; height: 500px; background-color: lightblue; } </style> </head> <body> <p>Click the "Try it" button to set the display property of the DIV element to "none":</p> <button onclick="myFunction()">Try it</button> <div id="myDIV"> This is my DIV element. </div> <p><b>Note:</b> The element will not take up any space when the display property set to "none".</p> <script> function myFunction() { document.getElementById("myDIV").style.display = "none"; } </script> </body> </html>