JSFiddle - React, Tailwind, and code Playground

by dzheka3d

HTML

<div class="main">

  <div class="flex">
  
    <div class="center">
    <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
    </div>

    <div class="right">
    
      <div class="stick">плавающий</div>
    
    </div>
  
  </div>
  
</div>

CSS

div{
  display: block;
}

.main {
    width: 80%;
    overflow: hidden;
    padding: 0 20px;
    margin:auto;
}

.flex {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-content: stretch;
}

.center{
  background: #eee;
  flex: 1 1 auto;
}

.right{
  background: #ccc;
  width: 200px;
}

.stick{
    position: -webkit-sticky;
    position: sticky;
    top: 10px;
    background: #F00;
    padding: 40px;
   
}