<body>
  <div class="relativebox">
    <div class="box">
      <div class="inner">
        absolute box
      </div>
      <div class="inner-fixed">
        fixed box
      </div>
    </div>  
  </div>
</body>
.relativebox {
  width: 200px;
  height: 200px;
  background-color: black;
  position: relative;
}
.box {
  width: 100px;
  height: 100px;
  background-color: gray
}

.inner {
  position:absolute;
  background-color: red;
  right: 0;
  width: 50px;
  height: 50px;
}

.inner-fixed {
  position:fixed;
  background-color: green;
  right: 0;
  width: 50px;
  height: 50px;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.