how do i add a background-image using inline style? suppose i have a image in my d drive named a.jpg ..what is the correct entry?? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how do i add a background-image using inline style? suppose i have a image in my d drive named a.jpg ..what is the correct entry??

21st Jul 2016, 7:31 AM
anil maharjan
anil maharjan - avatar
3 Answers
+ 3
It's better to move or copy the image to the same folder where you have your HTML documents. <body style="background:url('a.jpg');">
21st Jul 2016, 8:37 PM
ZinC
ZinC - avatar
+ 1
Try to avoid inline-style. It's better to use CSS. Create a folder "images" inside your main folder. Then add stylesheet "style.css" link to your HTML file. Insert code below into your "style.css". .your_block_class{ background-img: url(../images/a.jpg); } You can also use id, if you want.
22nd Aug 2016, 11:20 PM
alexey polev
alexey polev - avatar
- 1
body{ background:url("a.jpg") ; }
22nd Jul 2016, 8:22 AM
Osama Hasan
Osama Hasan - avatar