CSS opacity - background colour

0 votes

I want to set the opacity of a black div to.5, but I want the content of the div (the h3 tag) to be opaque at 1. Therefore, the white text's opacity hasn't altered and it is still white.

<div style="background-color:red;">
<div style="width:470px;color:white;margin-top:170px;">
<div style="background-color:black;opacity:0.5;">
<h3 style="color:white;opacity:1;">Heading </h3><p>tagline here</p>
</div>
</div>
</div>
Aug 25, 2022 in CSS by Edureka
• 13,620 points

edited Mar 4 44 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP