JSFiddle - React, Tailwind, and code Playground
HTML
<div class="container">
<div class="center-piece">
#1
</div>
<div class="center-piece2">
#2
</div>
</div>
CSS
.container {
height: 1200px;
background-color: rgba(0, 0, 0, .7);
color: white;
display: flex;
justify-content: center;
align-items: center;
}
.center-piece {
background-color: green;
position: sticky;
top: 10px;
bottom: 50%;
left: 50%;
transform: translate(-50%,50%);
}
.center-piece2 {
background-color: steelblue;
position: sticky;
bottom: 10px;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}