Change opacity of background-image:

Hello guys,

i did not find the way for change the opacity of my background image.

i tried with

divName img {
opacity: 0.5;
}

but it did not work.
Any suggestion?

Many thanks for your help guys

Your html code will affect how you write it (remember to format with </>)

Assuming you have <div class="img"><img src="someImg.jpg"></div>

your css would have to look something like

.img {
  opacity: 0.5;
}

Check the documentation (scroll all the way down) for examples that show this: https://developer.mozilla.org/en-US/docs/Web/CSS/opacity

Sorry i misspoke, i use the css background-image: url() like that

.presentation{
background-image: url(./img/myimage.jpg);
}

I see my background, but, i did not find solution to have opacity on this picture.

Do you have any solution ? Maybe i need to put my image on html and use opacity on css?

Maybe i need to put my image on html and use opacity on css?

Yes you can do that.

This doesn’t work?

.presentation{
   background-image: url(./img/myimage.jpg);
   opacity: 0.5;
}