Javascript 简单而丑陋 - 如何更改 div 位置?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4566595/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 13:00:00 来源:igfitidea点击:
Simple and ugly - How to change div position?
提问by DonCroce
How can i change the position of the element below
我怎样才能改变下面元素的位置
<div style="z-index:101; position: absolute; left: 0px; top: 324px; width: 20px; height:450px; padding: 0px; border: 0px;" id="wrapper" >Content</div>
To "left: 100px; top: 100px;"
到“左:100px;上:100px;”
I don't need a complex function, only a easy solution.
我不需要复杂的功能,只需要一个简单的解决方案。
Thanks for your help :)
谢谢你的帮助 :)
回答by PleaseStand
var div = document.getElementById('wrapper');
div.style.left = '100px';
div.style.top = '100px';