Window.getComputedStyle()

(Web API > Window)
https://developer.mozilla.org/ja/docs/Web/API/Window/getComputedStyle

window.getComputedStyle(element)

要素の算出されたスタイル(CSSのプロパティと指定されている値)を取得するには、Windows オブジェクトの getComputedStyle メソッドを使用する。戻り値はCSSStyleDeclarationオブジェクトを返す。

// #sample要素内の特定のプロパティの値を取得
var element = document.getElementById('sample'),
    style = window.getComputedStyle(element);
console.log(style.marginTop);

// h3:after(擬似要素)のcontentプロパティの値を取得
var h3 = document.querySelector('h3');
var result = getComputedStyle(h3, ':after').content;
inserted by FC2 system