-3

How to set opacity for bg-image in CSS without affecting the Context in the page.

1 Answers1

0

div {
  width: 300px;
  height: 200px;
  background: linear-gradient(rgba(80,80,80,.5), rgba(80,80,80,.5)), url("https://www.techeshta.com/wp-content/uploads/2020/12/Yagnik-Padaliya.jpg");
}
span {
  background: black;
  color: white;
}
<div>
  <span>Hello world.</span>
</div>