Heim > Fragen und Antworten > Hauptteil
console.log(document.getElementsByTagName("body")[0].style.margin) 空
console.log($("body").css("margin")) 8px
黄舟2017-07-05 10:44:07
你可以试试获取 width 之类的 的出来也是 ''
因为 XXX.style.XXX取出来的是行内属性啊喂
因为你通过XXX.style.XXX 设置的也是行内属性 所以次啊取得出来
那怎么去取出来用css设置的属性呢
getComputedStyle(element).margin