How can i set background picture using html or css | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How can i set background picture using html or css

i complie that code on phn using sololearn using background tag but it doesn't work i copy the local path address https://code.sololearn.com/WE6K2b5Oqwi1/?ref=app

29th May 2018, 4:54 PM
Ranjeet
Ranjeet - avatar
9 Answers
+ 4
2 things: * You have in the CSS tabs HTML code. You cannot do that. Make sure that everything in the CSS tab is styling stuff. * Next, you can get images from the web directly or put images on your phone or laptop on Dropbox and then use them in your code. In Code Playground you cannot use directly an image that is on your phone. Edit: Reet Here is a tutorial for using images you put on Dropbox https://www.sololearn.com/Discuss/1054246/?ref=app
29th May 2018, 5:03 PM
cyk
cyk - avatar
+ 11
There is some mistake in that code. 1st of all u have used an image for background which is in ur storage not ours. U should use the url of an image in the url tag. Secondly it is background-image not background_image. The inline styling of body is as follows : <body style="background-image: url( "http://www.sololearn.com/uploads/css_logo.png" )"></body>
29th May 2018, 5:00 PM
***
+ 9
Reet I told you it's background-image not background_image. Correct that. And the image url you used seems to be incorrect.
29th May 2018, 5:39 PM
***
+ 8
ok Reet see the styling of body in the css part of the code https://code.sololearn.com/WMoE618WMolH/?ref=app
29th May 2018, 5:51 PM
***
+ 3
Also, again, get rid of what you have now in the CSS tab and replace with this: html, body{ width: 100%; height: 100%; margin: 0; padding: 0; } This will assure that all the visible area is covered by the image
29th May 2018, 5:43 PM
cyk
cyk - avatar
+ 2
thanks
29th May 2018, 5:05 PM
Ranjeet
Ranjeet - avatar
+ 2
3 things: * Like Rohan had said: it has to be background-image not background_image * Make sure the link ends with .jpeg or .png... Otherwise it is not an image * You cannot have " " inside " ". I am talking about your styling part in the body tag. If the image links is surrounded by " ", surround the style parts with ' '.
29th May 2018, 5:41 PM
cyk
cyk - avatar
29th May 2018, 5:36 PM
Ranjeet
Ranjeet - avatar
+ 1
it doesn't work when i complie in css tab
29th May 2018, 5:37 PM
Ranjeet
Ranjeet - avatar