运行 ❯
获取您
自身
网站
×
更改方向
保存代码
更改主题,暗/亮
前往空间
<!DOCTYPE html> <html> <head> <style> div { border: 15px solid transparent; padding: 15px; border-image: url(border.png); border-image-slice: 30; border-image-repeat: round; } </style> </head> <body> <h1>Change border-image-slice with JavaScript</h1> <div id="main"> <h1>Hello</h1> </div> <p>Click the "Try it" button to change the value of the borderImageSlice property.</p> <button onclick="myFunction()">Try it</button> <script> function myFunction() { document.getElementById("main").style.borderImageSlice = "30%"; } </script> </body> </html>