How TO - Scroll Into View


Learn how to scroll into view with JavaScript.


The scrollIntoView() Method

The scrollIntoView() method scrolls an element into the visible area of the browser window.

Example

Scroll the element with id="content" into the visible area of the browser window:

const element = document.getElementById("content");
element.scrollIntoView();
Try it Yourself »

Learn more about the scrollIntoView() method in our JavaScript Reference.


Copyright 1999-2023 by Refsnes Data. All Rights Reserved.