I'm trying to create a div with a simple background color and some text on the div. I want to decrease the opacity of the background color of this div but when I do that the opacity of the text on the div is also getting changed. Is there a way to change the opacity of the background color only?
.main{
background-color: red;
width: 100%;
height: 200px;
opacity: 0.5;
}
<div class="main">
<p>Opacity of this text shouldn't be changed.</p>
</div>