I would like my cell to stick to the left or right of the scrollable container. As you can see the yellow cell is only sticking to the right side despite left: 0px
.
How can I get it to stick to both, as in if you scroll all the way to the right the cell should be stuck on the left side? Like this: https://stackblitz.com/edit/react-rgukbo?file=app/main.jsx
Edit: It seems if I change direction: ltr/rtl
on the container it sticks to one or the other but not both
.container {
width: 300px;
height: 100px;
overflow: auto;
}
.grid {
display: grid;
grid-template-columns: 200px 200px 80px 200px 200px 200px;
}
.cell {
padding: 10px;
border: 1px solid black;
background: white;
}
.sticky {
position: sticky;
left: 0px;
right: 0px;
z-index: 1;
background: yellow;
}
<div class="container">
<div class="grid">
<div class="cell">1</div>
<div class="cell">2</div>
<div class="cell sticky">3</div>
<div class="cell">4</div>
<div class="cell">5</div>
<div class="cell">6</div>
</div>
</div>