菜单切换
FACESOHO知行者
心灵
记录
远方
赞赏工具
源代码:
点击运行
保存
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>小鸟启蒙(facesoho.com)</title> <style> div{ background-image:url('/public/uploads/demo_source/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 type="button" onclick="displayResult()">修改背景图像位置</button> <br> <div id="div1"> </div> </body> </html>
运行结果