+ 1

Why background image not appearing on WordPress?

I have included this code in my css. body{ background: url("/wp-content/themes/my_theme/images.png" ); } But background image not appearing in my WordPress site. Please help.

8th Sep 2020, 6:10 AM
Moshtafizur Rahman Anty
Moshtafizur Rahman Anty - avatar
9 Antworten
+ 2
Moshtafizur Rahman Anty it should work if you actually use the full src url... can you show us your image. https://code.sololearn.com/W1zxxhk3897w/?ref=app please use searchbar before asking as this may help you find your answer faster and reduce duplicate questions. Because this is such a frequently asked question I created a post to make this easier. https://www.sololearn.com/post/459751/?ref=app however feel free to search further by typing the keywords - images HTML ... https://www.sololearn.com/discuss/1668777/?ref=app https://www.sololearn.com/discuss/519734/?ref=app https://www.sololearn.com/discuss/9137/?ref=app https://www.sololearn.com/discuss/1442068/?ref=app https://www.sololearn.com/discuss/1887343/?ref=app https://www.sololearn.com/discuss/2199796/?ref=app https://www.sololearn.com/discuss/2401922/?ref=app https://www.sololearn.com/discuss/240974/?ref=app
8th Sep 2020, 6:22 AM
BroFar
BroFar - avatar
+ 2
Just confirming something ... I see a space between last path separator and filename. Does the filename really begin with a space? I would also note that relative path should be relative to the referring HTML file path, and not the CSS file path.
8th Sep 2020, 6:55 AM
Ipang
+ 2
Ipang Actually it was a post mistake and now I have corrected it. I didn't understand your second note.All I can say the html and css are in root of my theme folder.
8th Sep 2020, 7:01 AM
Moshtafizur Rahman Anty
Moshtafizur Rahman Anty - avatar
+ 1
@Mr. KHAN image is within the theme folder and I am manually modyfying theme.
8th Sep 2020, 7:16 AM
Moshtafizur Rahman Anty
Moshtafizur Rahman Anty - avatar
+ 1
@Mr . Khan no , it's not working also.
8th Sep 2020, 8:58 AM
Moshtafizur Rahman Anty
Moshtafizur Rahman Anty - avatar
+ 1
okay I find it out. My wp-content folder was also inside a folder named wordpress. so the correct code would be : body { background : url("/wordpress/wp-content/themes/my_theme/images.png"); }
9th Sep 2020, 4:28 PM
Moshtafizur Rahman Anty
Moshtafizur Rahman Anty - avatar
0
Moshtafizur Rahman Anty Can you share here the related folder structure? cause Idk how it's like and guessing wouldn't help ...
8th Sep 2020, 7:08 AM
Ipang
0
I would suggest not use relative path, instead use the absolute path, Second thing, are you sure the image is within the theme folder? Not in Uploads? Thirdly, are you using wp customize option or you are manually modifying the theme?
8th Sep 2020, 7:13 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
0
Then your style.css file is also inside the theme folder, and the path you have used is wrong.. The style.css is located inside your theme, and looking at your image path it is also within the my_theme folder, then u can use directly, background-image : url('images.png');
8th Sep 2020, 7:21 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar