+ 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.
9 Respostas
+ 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
+ 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.
+ 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.
+ 1
@Mr. KHAN image is within the theme folder and I am manually modyfying theme.
+ 1
@Mr . Khan no , it's not working also.
+ 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");
}
0
Moshtafizur Rahman Anty
Can you share here the related folder structure? cause Idk how it's like and guessing wouldn't help ...
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?
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');