Document: scrollingElement property

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 potentially scrollable, otherwise it returns null.


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


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


CSSOM View Module
# dom-document-scrollingelement

Browser compatibility

BCD tables only load in the browser