freeCodeCamp Challenge Guide: Change the Position of Overlapping Elements with the z-index Property

Change the Position of Overlapping Elements with the z-index Property

Solution (Click to show/hide)
<style>
  div {
    width: 60%;
    height: 200px;
    margin-top: 20px;
  }

  .first {
    background-color: red;
    position: absolute;
    z-index: 2;
  }

  .second {
    background-color: blue;
    position: absolute;
    left: 40px;
    top: 50px;
    z-index: 1;
  }
</style>

<div class="first"></div>
<div class="second"></div>
5 Likes