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 September 2020.

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

Report problems with this compatibility data on GitHub
desktopmobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
scrollingElement

Legend

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

Full support
Full support