Element.scroll() is an instance method from the CSSOM View module. It scrolls an element to specific coordinates inside that element. Learn absolute positioning, behavior: "smooth", the Promise interrupted flag, and five try-it labs.
01
Kind
Instance method
02
Action
Scroll to coords
03
Alias
scrollTo()
04
Returns
Promise
05
behavior
smooth / instant
06
Status
Baseline widely
Fundamentals
Introduction
Long pages, chat logs, and side panels often overflow their container. Instead of only setting element.scrollTop, you can call scroll() to jump to an absolute position—optionally with smooth animation.
MDN: scroll() is an alias of scrollTo(). Modern browsers return a Promise that resolves with { interrupted } so you can run code when a smooth scroll finishes (or was cut short by another scroll).
💡
Beginner tip
The element must be scrollable (overflow: auto or scroll). Use scrollTop to read the current position; use scroll() to set it programmatically.
Calling el.scroll(x, y) or el.scroll({ top, left, behavior }) scrolls the element’s content so the given coordinates appear at the top-left of the visible scrollport.
It is an instance method on Element (CSSOM View).
Alias of scrollTo() with the same syntax (MDN).
Returns a Promise with { interrupted: boolean } (MDN).
Element.scroll() is Baseline Widely available (MDN: across browsers since January 2020). Logos use the shared browser-image-sprite.png sprite from this project.
✓ Baseline Widely available
Element.scroll()
Safe for production. Scroll an element to absolute coordinates with optional smooth behavior.
BaselineWidely available
Google ChromeSupported · Desktop & Mobile
Yes
Microsoft EdgeSupported · Chromium
Yes
Mozilla FirefoxSupported · Desktop & Mobile
Yes
Apple SafariSupported · macOS & iOS
Yes
OperaSupported · Modern versions
Yes
Internet ExplorerLegacy scrollTop only · no Promise return
No
scroll()Excellent
Bottom line: Use scroll() for absolute positions, scrollBy() for relative nudges, and await the Promise when you need to know if a smooth scroll was interrupted.
Wrap Up
Conclusion
Element.scroll() scrolls an element to absolute coordinates inside itself. It is the same as scrollTo(), supports smooth animation, and returns a Promise you can await when building polished scroll UX.
Await the Promise to run UI after smooth scroll ends
Check scrollHeight before scrolling far down
Prefer options object syntax for clarity
❌ Don’t
Confuse scroll() with scrollBy()
Scroll elements without overflow content
Assume IE returns a Promise
Fire many smooth scrolls without handling interrupted
Forget that scroll() affects the element, not always window
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about Element.scroll()
Absolute scroll coordinates—optional smooth animation and Promise result.
5
Core concepts
📝01
Returns
Promise
API
📄02
Alias
scrollTo
Same
✍️03
Coords
absolute
Position
✅04
Baseline
widely available
Status
⚡05
Flag
interrupted
Promise
❓ Frequently Asked Questions
It scrolls an element to a particular set of coordinates inside that element (MDN). You can pass x/y numbers or an options object with top, left, and behavior.
No. MDN marks Element.scroll() as Baseline Widely available (across browsers since January 2020). It is not Deprecated, Experimental, or Non-standard.
A Promise that fulfills with an object containing interrupted — true if another programmatic scroll interrupted this one before it finished (MDN).
scroll() (same as scrollTo()) jumps to absolute coordinates. scrollBy() scrolls relative to the current position by a delta.
Optional string: smooth (animated), instant (jump), or auto (uses CSS scroll-behavior). Default is auto (MDN).
Yes. MDN documents scroll() as an alias of scrollTo() with identical syntax and behavior.
Did you know?
element.scroll() and element.scrollTo() are the same method. Use scrollBy() when you want to move relative to the current position instead of jumping to absolute coordinates.