Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<style>
#myDIV {
  height: 250px;
  width: 250px;
  overflow: auto;
}
#content {
  height: 800px;
  width: 2000px;
  background-color: coral;
}
</style>
<body>
<h1>The Element Object</h1>
<h2>The scrollTop and scrollLeft Properties</h2>
<p>Click "Scroll" to scroll the contents of "myDIV" to 50px horizontally and 10px vertically.</p>
<button onclick="myFunction()">Scroll</button><br><br>
<div id="myDIV">
  <div id="content">
  <p>Some text inside a div element.</p>
  <p>Some text inside a div element.</p>
  <p>Some text inside a div element.</p>
  <p>Some text inside a div element.</p>
  </div>
</div>
<script>
function myFunction() {
  const element = document.getElementById("myDIV");
  element.scrollLeft = 50;
  element.scrollTop = 10;
}
</script>
</body>
</html>