JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<div class="container">
<div class="sidebar">
<div class="test1"></div>
<div class="test2"></div>
</div>
<div class="mainpage"></div>
</div>
<div class="footer"></div>
</body>
CSS
.container{
/*width: 1654px;*/
width: 100%;
background-color: #f0f0f0;
margin: 0 auto;
}
.sidebar{
position: sticky;
bottom: 10px;
/* top: 10px; */
width: 30%;
margin: 5px;
background-color: teal;
height: 1000px;
display: inline-block;
}
.mainpage{
width: 67%;
margin: 5px;
margin-left: 0px;
background-color: steelblue;
height: 2000px;
display: inline-block;
}
.footer{
height: 500px;
width: 100%;
margin: 0 auto;
margin-top: 10px;
background-color: purple
}
.test1{
background-color: red;
position: relative;
left: 0;
right: 0;
top: 0;
height: 200px;
}
.test2{
background-color: red;
position: relative;
left: 0;
right: 0;
bottom: 0;
height: 200px;
}