JSFiddle - React, Tailwind, and code Playground

by 亮 薛

HTML

<div class="outer">
    <div class="middle">
      <div class="inner"></div>
    </div>
  </div>

CSS

.outer {
  position: relative;
  height: 500px;
  width: 500px;
  background-color: orange;
  padding-top: 100px; /*i have to use padding, otherwise i cant get the middle box in the center*/
  box-sizing: border-box;
  margin: 0 auto;
}
.middle {
  position: static;
  height: 300px;
  width: 300px;
  background-color: aqua;
  margin: 0 auto;
}
.inner {
  position: absolute;
  width: 100px;
  height: 100px;
  margin-bottom: 10000px;
  margin-right: 10000px;
  margin-left: 10px;
  margin-top: 10px;
  background-color: red;
  /*left: 0;*/
  /* top: 0; */
}