Document: scrollingElement property

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since August 2016.

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. This may look surprising but is true according to both the specification and browsers.

Value

The Element that scrolls the document, usually the root element (unless not in standard mode).

Examples

js
const scrollElm = document.scrollingElement;
scrollElm.scrollTop = 0;

Specifications

Specification
CSSOM View Module
# dom-document-scrollingelement

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
scrollingElement
Chrome – Full support
Chrome 44 (Release date: 2015-07-21)
footnote Full support
Edge – Full support
Edge 12 (Release date: 2015-07-29)
footnote Full support
Firefox – Full support
Firefox 48 (Release date: 2016-08-02)
footnote Full support
Opera – Full support
Opera 31 (Release date: 2015-08-04)
footnote Full support
Safari – Full support
Safari 9 (Release date: 2015-09-30)
footnote Full support
Chrome Android – Full support
Chrome Android 44 (Release date: 2015-07-29)
footnote Full support
Firefox for Android – Full support
Firefox for Android 48 (Release date: 2016-08-02)
footnote Full support
Opera Android – Full support
Opera Android 32 (Release date: 2015-09-23)
footnote Full support
Safari on iOS – Full support
Safari on iOS 9 (Release date: 2015-09-16)
footnote Full support
Samsung Internet – Full support
Samsung Internet 4 (Release date: 2016-03-11)
footnote Full support
WebView Android – Full support
WebView Android 44 (Release date: 2015-07-29)
footnote Full support
WebView on iOS – Full support
WebView on iOS 9 (Release date: 2015-09-16)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support