编辑下面的代码:【加编码】
<html> <head> <style> div { background-color:lightgrey; border:30px solid transparent; border-image: url('border.png'); border-image-slice: 30; border-image-width: 1 1 1 1; border-image-outset: 0; border-image-repeat: round; } </style> </head> <body> <div id="main"> <p> 这是一个使用图像作为边框的 DIV 元素。 </p> </div> <p>下面是两个要使用的图像:</p> <img src="/demo/border.png"> <img src="/demo/img_flwr.gif"> <p>点击“尝试一下”按钮改变 borderImageSource 属性的值。</p> <button onclick="myFunction()">尝试一下</button> <script> function myFunction() { document.getElementById("main").style.borderImageSource = "url('img_flwr.gif')"; } </script> <p><b>注意:</b>Internet Explorer 10、Opera 和 Safari 5 不支持 borderImageSource 属性。</p> </body> </html>
结果: 【此窗口】 帮助?
Try it Yourself - © 自强学堂