Image opacity problem ๐Ÿ˜ฅ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Image opacity problem ๐Ÿ˜ฅ

Hey .div{ width:100%; height:100vh; background-image:url(https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSYkraKMg7S1KIMbdjOUFlBVH8n8nvG5DOUVg&usqp=CAU); } I only want to change the opacity of image but instead it changes the opacity of whole div how to do it ???

21st May 2022, 7:21 AM
CODY RAZA ใƒ„
CODY RAZA ใƒ„ - avatar
4 Answers
+ 1
Select only the image of d div in the css and use opacity Example div > img { Opacity:...; }
23rd May 2022, 1:57 AM
Mikeey
Mikeey - avatar
+ 4
Perhaps what you can do is to have an image element in the div element, and then make sure that the image element completely covers the div element. Then, apply the opacity parameter to it.
21st May 2022, 7:24 AM
๐Ÿ‘‘ Prometheus ๐Ÿ‡ธ๐Ÿ‡ฌ
๐Ÿ‘‘ Prometheus ๐Ÿ‡ธ๐Ÿ‡ฌ - avatar
+ 2
๐Ÿ‘‘ Prometheus ๐Ÿ‡ธ๐Ÿ‡ฌ can you write the code please
21st May 2022, 7:25 AM
CODY RAZA ใƒ„
CODY RAZA ใƒ„ - avatar
- 1
Put a img tag into your div. Then style the img.
22nd May 2022, 9:48 AM
Ryan Zarif
Ryan Zarif - avatar