<div>
  <div class="box01">
    箱
  </div>
  <div class="box02">
    <div class="box-child">小さい箱</div>
  </div>
</div>
div{
  text-align: center;
}
.box01,.box02{
  border: dotted 1px #ccc;
  width: 150px;
}
.box01{
  background-color: lightblue;
}
.box02{
  margin-top: 10px;
  background-color: lightyellow;
}
.box-child{
  background-color: pink;
  margin-top: 50px;
}
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.