Javascript 改变<;部门>;CSS属性
我在JavaScript中有一个Javascript 改变<;部门>;CSS属性,javascript,jquery,html,Javascript,Jquery,Html,我在JavaScript中有一个元素引用,如下所示: custom_div = document.createElement("div") 我想通过JavaScript将此元素的位置更改为绝对,并将底部对齐设置为0。我正在寻找建议。有很多方法可以做到这一点,但不建议直接操作DOM。使用或尝试。您只需使用: document.getElementById("div#example").style.position="absolute"; document.getElementById("div#
元素引用,如下所示:
custom_div = document.createElement("div")
我想通过JavaScript将此元素的
位置
更改为绝对
,并将底部
对齐设置为0
。我正在寻找建议。有很多方法可以做到这一点,但不建议直接操作DOM。使用或尝试。您只需使用:
document.getElementById("div#example").style.position="absolute";
document.getElementById("div#example").style.bottom="0";
你试过什么?你在哪里卡住了?你的密码在哪里?您搜索过jQuery API吗?您刚刚创建了一个元素,除非您将它放在某个地方,否则它的样式实际上并不重要,但它将是
custom\u div.style.position='absolute'
等。可能重复: