arent:before {
            z-index: -1;
            content: '';
            position: absolute;

            opacity: 0.2;
            width: 400px;
            height: 20px;
            background-color: black
        }

        .child{
            Color:blue;
        }
    </style>

<h3>Color using Class Tests</h3>


<div class="parent">
  <div class="child"> parent black opacity 0.2 and child blue </div>
</div>

<div style="background-color:black; opacity: 0.2; margin-top:50px;">
  <div style='color:red