<main class="wrap">
<div class="pink">Pink
  <span class="pink-child">Pink Child<span class="pink-grandchild">Pink Grandchild</span></span>
</div>
  <div class="yellow">Yellow<span class="yellow-child">Yellow Child</span></div>

<div class="green">Green</div>
</main>

.wrap {
  padding: 60px;
}
div {
  display: inline-block;
  vertical-align: middle;
  padding: 30px;
  font-size: 2rem;
}
.pink {
  width: 360px;
  height: 360px;
  background-color: pink;
  /* uncomment the line below to create a stacking context in the Pink square */
/*   opacity: .8; */
}
.yellow {
  width: 240px;
  height: 240px;
  background-color: gold;
  margin-left: -60px;
  margin-bottom: -60px;
  /* uncomment the line below to create a stacking context in the Yellow square */
/*   transform: rotate(90deg); */
}
.green {
  width: 120px;
  height: 120px;
  background-color: lightgreen;
  margin-left: -40px;
}
span {
  padding: 15px 30px;
}
.pink-child {
  background-color: hotpink;
  position: relative;
  top: 180px;
  left: 0;
}
.pink-grandchild {
  background-color: deeppink;
  color: white;
  white-space: nowrap;
  position:absolute;
  left:120px;
  bottom:20px;
  z-index: 2;
}

.yellow-child {
  background-color: orange;
  white-space: nowrap;
  position: relative;
  top: 120px;
  left: -120px;
  z-index: 3;
}

[class*="pink"], 
[class*="yellow"],
[class*="green"] {
  border: 2px dashed black;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.