Can anyone tell me how to add background image in HTML or CSS? With the aid of an example? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone tell me how to add background image in HTML or CSS? With the aid of an example?

Can anyone tell me how to add background image in HTML or CSS? With the aid of an example?

20th Dec 2020, 12:20 PM
Atul [Inactive]
7 Answers
+ 2
body { background-image: url("link"); }
20th Dec 2020, 12:25 PM
Սոֆի Մովսեսյան
Սոֆի Մովսեսյան - avatar
+ 1
1)go to css file 2)select the element you want to add a background to it (exp: body) 3)set the background like this : background-image:url("image.png"); ====≠================ exp: body{ background-image:url("image.png"); background-size:cover; } you can copy a url image from a website and paste it in the url
20th Dec 2020, 12:30 PM
Med Amine Fh
Med Amine Fh - avatar
+ 1
Atul Panda remove img src just the link of the img. background-image:url("https://source.unsplash.com/user/erondu/1600x900")
20th Dec 2020, 12:37 PM
Med Amine Fh
Med Amine Fh - avatar
+ 1
Thank you
20th Dec 2020, 12:54 PM
Atul [Inactive]
0
I tried it but it is not functioning. Please insert a link and share me the code
20th Dec 2020, 12:27 PM
Atul [Inactive]
20th Dec 2020, 12:36 PM
Atul [Inactive]
0
This is what I tried. Correct my mistakes if you find the errors
20th Dec 2020, 12:36 PM
Atul [Inactive]