JS读取、设置margin

读取

var div = document.getElementById("myDiv");
var computedStyle = getComputedStyle(div, null); alert(computedStyle.marginTop);

设置

document.getElementById("ex1").style.marginBottom="100px";

 

posted @ 2023-07-06 16:31  Fengnuoyiman  阅读(360)  评论(0)    收藏  举报