# Changing an element scrolling in JavaScript

You can change the properties that contain element scrolling. In this case, the element will scroll to the specified value. Let's for example scroll the element to position of `200px` from the top:

`elem.scrollTop = 200;`

Now let's scroll the element by `100px` down from the current value:

`elem.scrollTop = elem.scrollTop + 100;`

Now scroll the element to the end:

`elem.scrollTop = elem.scrollHeight - elem.clientHeight;`

Given an element and a button. On button click, scroll the element to `100px` scroll position vertically and `50px` horizontally.

Given an element and a button. On button click, scroll the element by `50px` down from the current scroll position.

Given an element and a button. By clicking on the button, scroll the element to the very top.

Given an element and a button. By clicking on the button, scroll the element to the very bottom.

← →
↑
en ru