[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/API/Element/scrollIntoView [Back]  [Original]

element.scrollIntoView - Web API | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

element.scrollIntoView

Baseline Widely available *

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2020 1.

* Some parts of this feature may have varying levels of support.

Element scrollIntoView() scrollIntoView() .

In this article

js
element.scrollIntoView();
element.scrollIntoView(alignToTop); // Boolean parameter
element.scrollIntoView(scrollIntoViewOptions); // Object parameter

alignToTop Optional

.

  • true , . scrollIntoViewOptions: {block: "start", inline: "nearest"} . .
  • false , . scrollIntoViewOptions: {block: "end", inline: "nearest"} .
scrollIntoViewOptions Optional

.

behavior Optional

. .

block Optional

. start, center, end, nearest . start.

inline Optional

. start, center, end, nearest . nearest.

(undefined).

js
const element = document.getElementById("box");

element.scrollIntoView();
element.scrollIntoView(false);
element.scrollIntoView({ block: "end" });
element.scrollIntoView({ behavior: "smooth", block: "end", inline: "nearest" });

.

Specification
CSSOM View Module
# dom-element-scrollintoview


Web Proxy Viewer  |  New URL  |  Original Page