2013-07-01 6 views

Antwort

4
window.getComputedStyle(document.body).marginTop 

document.body.style kehrt Inline-Styles

1

Sie es wie folgt tun:

var e = document.getElementsByTagName('body')[0], 
style = window.getComputedStyle(e), 
marginTop = style.getPropertyValue('margin-top'); 

console.log(marginTop); 

Verwandte Frage und Antwort finden Sie hier: Using JavaScript to read html/body tag margin-top

Verwandte Themen