The Element.scrollLeft property gets or sets the number of pixels that an element's content is scrolled from its left edge.
If the element's direction is rtl (right-to-left), then scrollLeft is 0 when the scrollbar is at its rightmost position (at the start of the scrolled content), and then increasingly negative as you scroll towards the end of the content.
It can be specified as any integer value. However:
- If the element can't be scrolled (e.g., it has no overflow),
scrollLeftis set to0. - If specified as a value less than
0(greater than0for right-to-left elements),scrollLeftis set to0. - If specified as a value greater than the maximum that the content can be scrolled,
scrollLeftis set to the maximum.
Warning: On systems using display scaling, scrollLeft may give you a decimal value.