JSFiddle - React, Tailwind, and code Playground

HTML

<div id='div1'>Ini elemen Induk dan tidak menggunakan position:relative
  <div class='div2'>Ini DIV2 dengan position:fixed, top:0 dan right:0</div>
  <div class='div3'>Ini DIV3 dengan position:fixed, top:150 dan right:0</div>
</div>

CSS

body {
  background: #f2f2f2;
  font: normal 12px Arial;
}

#div1 {
  background: black;
  height: 1200px;
  width: 80%;
  line-height: 150px;
  margin: 20px auto;
  text-align: center;
  color: white;
}

.div2 {
  background: red;
  width: 300px;
  height: 50px;
  line-height: 50px;
  top: 0;
  right: 0;
  position: absolute;
}

.div3 {
  background: green;
  width: 300px;
  height: 50px;
  line-height: 50px;
  top: 150px;
  right: 0;
  position: fixed;
}