Why my background-repeat property is not working? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why my background-repeat property is not working?

I want to use the opacity property too... So please tell me a solution where I can repeat the background image and can adjust the opacity of the image. If I use background-image property I could not select the image to set the opacity of that image. So I need a proper solution https://code.sololearn.com/Wj8f9fVdstMA/?ref=app

26th Oct 2022, 10:52 AM
Pooja Sahoo
Pooja Sahoo - avatar
4 Answers
+ 3
Pooja Sahoo Background-repeat works only if your code uses background-image for the particular tag. and <img> tag is only to insert image not to set background. Background image can be set by writing following code in css file: tag_name { background-image: url(“URL“); } your code should be like this: https://code.sololearn.com/WUWZ0ClwdRbQ/?ref=app
26th Oct 2022, 11:08 AM
I am offline
I am offline - avatar
+ 2
I would recommend to just put the image as a background-image in the css for the body. Then it is working, you can leave out the img tag in html. Just put in the body css: body { background-image: url(“yoururl“); }
26th Oct 2022, 11:02 AM
Ricarda
Ricarda - avatar
+ 2
But I can not use opacity in background-image:url();
26th Oct 2022, 11:27 AM
Pooja Sahoo
Pooja Sahoo - avatar
+ 1
Pooja Sahoo I've edited the code if you need any further changes please notify about that
26th Oct 2022, 11:50 AM
I am offline
I am offline - avatar