Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<head>
<style>
#container {
  width: 80%;
  aspect-ratio: 3/2;
  margin: auto;
  border: solid black 2px;
  overflow-x: scroll;
  overflow-y: hidden;
  white-space: nowrap;
  scroll-snap-type: x mandatory;
}
.blue {
  background-color: lightblue;
  height: 95%;
  aspect-ratio: 1/2;
}
.green {
  background-color: lightgreen;
  height: 50%;
  aspect-ratio: 2/1;
}
.blue, .green {
  display: inline-block;
  margin-top: 2%;
  scroll-snap-align: start;
  scroll-margin-left: 0;
}
</style>
</head>
<body>
<h1>Change scroll-margin-left property with JavaScript</h1>
<p>Try first to scroll to see how the scroll snaps on start of elements on x-axis.</p>