0

Whats wrong with this code?

HELLO! I want to attch an image into the background of my web page. See the code- <!DOCTYPE html> <html> <head> <style> .background{ background-image: url("link.jpg");} </style> </head> <body> <div class="background"><p> random text with a background image</p> </div> </body> </html> In this code after saving, only this text "random text with a background image" is showing in my webpage. But the image is not loading can anyone explain why it is happening.

17th Oct 2020, 7:22 AM
Dhruv Kohli
Dhruv Kohli - avatar
5 Answers
+ 3
Try with quotes, ("C......lighthouse.jpg");
17th Oct 2020, 7:43 AM
Mariano Fregosi
Mariano Fregosi - avatar
+ 1
can u give the image's link?
17th Oct 2020, 7:27 AM
durian
durian - avatar
0
I don't know how to embed the image in sololearn, so you are requested kindly check my profile.you will find an image of sublime text editor.
17th Oct 2020, 7:37 AM
Dhruv Kohli
Dhruv Kohli - avatar
0
try using relative path
17th Oct 2020, 7:52 AM
durian
durian - avatar