The scrollingElement read-only property of the Document interface returns a reference to the Element that scrolls the document. In standards mode, this is the root element of the document, document.documentElement.

When in quirks mode, the scrollingElement attribute returns the HTML body element if it exists and is not potentially scrollable, otherwise it returns null.


var element = document.scrollingElement;


var scrollElm = document.scrollingElement;
scrollElm.scrollTop = 0;


Specification Status Comment
CSS Object Model (CSSOM) View Module
The definition of 'scrollingElement' in that specification.
Working Draft Initial definition

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support44 Yes


47 — 481

FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support4444 Yes Yes319 ?

1. From version 47 until version 48 (exclusive): this feature is behind the dom.document.scrollingElement.enabled preference. To change preferences in Firefox, visit about:config.

Document Tags and Contributors

Last updated by: russelldavis,