Questo contenuto viene visualizzato in inglese perché non è ancora disponibile una versione tradotta nella lingua selezionata. Aiutaci a tradurre questo articolo!

This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

Element.currentStyle is a proprietary property which is similar to the standardized window.getComputedStyle() method. It is available in old versions of Microsoft Internet Explorer. However, it returns the units set in CSS while window.getComputedStyle() returns the values in pixels.


This polyfill returns the values in pixels and is likely to be rather slow, as it has to call window.getComputedStyle() every time its value is read.

/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

if (!("currentStyle" in Element.prototype)) {
  Object.defineProperty(Element.prototype, "currentStyle", {
    get: function() {
      return window.getComputedStyle(this);


Not part of any specification.

Microsoft has a description on MSDN.

Browser compatibility

Update compatibility data on GitHub
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
Chrome No support NoEdge No support NoFirefox No support NoIE Full support 6Opera No support NoSafari No support NoWebView Android No support NoChrome Android No support NoFirefox Android No support NoOpera Android No support NoSafari iOS No support NoSamsung Internet Android No support No


Full support  
Full support
No support  
No support
Non-standard. Expect poor cross-browser support.
Non-standard. Expect poor cross-browser support.

See also