Element.scrollLeft gets or sets how far an element’s content is scrolled horizontally from its left edge, in CSS pixels. A positive value means the content has moved to the right (MDN).
Read the notes below before you get or set this property. Prefer feature detection when support is limited.
Syntax
Use el.scrollLeft. Start with this line.
JavaScript
element.scrollLeft
Call
What it does
element.scrollLeft
Primary signature.
Built into the browser. Read or assign el.scrollLeft — no import required.
Reset. Assigning 0 returns to the usual LTR start.
Confirm. Reading again shows 0.
Tip. For animated scroll, prefer element.scroll() with behavior: "smooth".
Compatibility
Browser Support
Element.scrollLeft is Baseline Widely available (MDN: since July 2015). Safe across modern and older evergreen browsers.
✓ Baseline · Widely available
Element.scrollLeft
Get or set horizontal scroll offset in CSS pixels — long-standing CSSOM View support.
99%Widely available
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
scrollLeftExcellent
Bottom line: Safe for production. Remember subpixel values, RTL sign differences, and Safari overscroll behavior when writing edge checks.
Frequently Asked Questions
It gets or sets how many pixels the element's content is scrolled horizontally from its left edge. A positive value means the content has been scrolled to the right.
No. MDN marks Element.scrollLeft as Baseline Widely available (since July 2015). It is not Deprecated, Experimental, or Non-standard.
Yes. Modern browsers can return subpixel-precise floating-point values, so scrollLeft is not always a whole number.
It is usually 0 when the element has not been scrolled horizontally. If the document is not the active document, the returned value is 0.
Yes, in some layouts (for example RTL where content grows left). scrollLeft can be 0 at the start and increasingly negative as you scroll toward the end.
scrollLeft is the current horizontal scroll offset. scrollWidth is the total width of the scrollable content.