<!DOCTYPE html>

<html>
<head>
<style>
    body {
        margin: 0;
        width: 2000px;
        overflow: hidden; /* hide scrollbars */
    }
    
    .group {
        position: relative;
        width: 500px;
        height: 160px;
    }
    
    .container {
        -webkit-writing-mode: vertical-rl;
        width: 300px;
        height: 160px;
        border: 2px solid black;
        margin: 10px;
    }
    
    .box {
        width: 200px;
        height: 180px;
    }

    .sticky {
        position: relative;
        background-color: green;
        width: 100px;
        height: 100px;
        margin: 5px;
    }
</style>
</head>
<body>
    <div class="group" style="left: -200px">
        <div class="container">Before
            <div class="sticky box" style="left: 18px;"></div>After
        </div>
    </div>

    <div class="group" style="left: 300px">
        <div class="container">Before
            <div class="sticky box"></div>After
        </div>
    </div>

    <div class="group" style="left: 700px">
        <div class="container">Before
            <div class="sticky box" style="left: -172px;"></div>After
        </div>
    </div>
</body>
</html>
