Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<head>
<style>
#container {
  width: 50%;
  aspect-ratio: 2/3;
  margin: auto;
  border: solid black 2px;
  overflow-x: scroll;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  writing-mode: vertical-rl;
}
      
#container > div {
  margin: 2px;
  scroll-snap-align: end none;
  scroll-margin-bottom: 30px;
}
.green {
  background-color: lightgreen;
  width: 95%;
  aspect-ratio: 4/3;
}
.blue {
  background-color: lightblue;
  width: 80%;
  aspect-ratio: 3/2;
}
</style>
</head>
<body>
<h3>CSS scroll-margin-bottom with altered snap position.</h3>
<p>Snap position must be placed on bottom of the child elements for scroll-margin-bottom to work. On pages written in English the snap position can normally be set on bottom of child elements by setting scroll-snap-align to "end none" because block direction is downwards. But, if we change block direction with the writing-mode property value set to "vertical-rl", the snap position changes from bottom to left side of the child elements. With the code like this the scroll-margin-bottom property no longer works.</p>
<div id="container">
  <div class="blue">Blue</div>
  <div class="green">Green</div>
  <div class="blue">Blue</div>
  <div class="green">Green</div>
  <div class="blue">Blue</div>
  <div class="green">Green</div>
  <div class="blue">Blue</div>