--- title: element.scrollIntoView slug: Web/API/Element/scrollIntoView translation_of: Web/API/Element/scrollIntoView ---
{{APIRef("DOM")}}
{{domxref("Element")}} 인터페이스의 scrollIntoView() 메소드는 scrollIntoView()가 호출 된 요소가 사용자에게 표시되도록 요소의 상위 컨테이너를 스크롤합니다.
element.scrollIntoView(); element.scrollIntoView(alignToTop); // Boolean parameter element.scrollIntoView(scrollIntoViewOptions); // Object parameter
alignToTop {{optional_inline}}true일때, the top of the element will be aligned to the top of the visible area of the scrollable ancestor. Corresponds to scrollIntoViewOptions: {block: "start", inline: "nearest"}. This is the default value.false일때, the bottom of the element will be aligned to the bottom of the visible area of the scrollable ancestor. Corresponds to scrollIntoViewOptions: {block: "end", inline: "nearest"}.scrollIntoViewOptions {{optional_inline}} {{experimental_inline}}behavior {{optional_inline}}"auto", "smooth"중 하나 선택. 기본값은 "auto".block {{optional_inline}}"start", "center", "end", "nearest"중 하나 선택. 기본값은 "start".inline {{optional_inline}}"start", "center", "end", "nearest"중 하나 선택. 기본값은 "nearest".var element = document.getElementById("box");
element.scrollIntoView();
element.scrollIntoView(false);
element.scrollIntoView({block: "end"});
element.scrollIntoView({behavior: "smooth", block: "end", inline: "nearest"});
다른 요소의 레이아웃에 따라 위쪽 또는 아래쪽으로 완전히 스크롤되지 않을 수 있습니다.
| Specification | Status | Comment |
|---|---|---|
| {{SpecName("CSSOM View", "#dom-element-scrollintoview", "Element.scrollIntoView()")}} | {{Spec2("CSSOM View")}} | Initial definition |
{{Compat("api.Element.scrollIntoView")}}