简单教程
提交运行
代码编辑器:
<style> div{ background-image: url('/static/i/javascript/basic/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> <button type="button" onclick="displayResult()">修改背景图像位置</button> <br> <div id="div1"> </div>
运行结果: