运行 ❯
获取您的
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <head> <style> #myDIV { width: 300px; height: 300px; padding: 50px; background-color: coral; background-clip: border-box; color: white; border: 5px dotted lightgrey; } </style> </head> <body> <h1>Change background-clip with JavaScript</h1> <p>Click the "Try it" button to set the background-clip property of the DIV element to "content-box":</p> <button onclick="myFunction()">Try it</button> <div id="myDIV"> Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. </div> <script> function myFunction() { document.getElementById("myDIV").style.backgroundClip = "content-box"; } </script> </body> </html>