BootWiki教程网
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>BootWiki 教程网</title> <style> div{ background-image: url('img_tree.png'); background-repeat: no-repeat; width: 400px; height: 400px; border: 1px solid #000000; } </style> <script> function displayResult(){ document.getElementById("div1").style.backgroundPosition="center bottom"; } </script> </head> <body> <button onclick="displayResult()" type="button">修改背景图像位置</button> <br> <div id="div1"> </div> </body> </html>
运行结果