在 JS 中使用 .style.top 方法,如下,发现不生效。
var box = document.createElement('div');
box.style.top = 30;
解决:
需要添加单位 px、cm 等.
var box = document.createElement('div');
box.style.top = 30 + “px”;
在 JS 中使用 .style.top 方法,如下,发现不生效。
var box = document.createElement('div');
box.style.top = 30;
需要添加单位 px、cm 等.
var box = document.createElement('div');
box.style.top = 30 + “px”;