0
votes

I am trying to put a background image to wordpress twenty thirteen theme static home page. I've created a child theme and put the following code in style.css in child theme.

body{
    background:url('wp-content/uploads/2015/09/Road-604x270.jpg');
}

#main{
     background:url('wp-content/uploads/2015/09/Road-604x270.jpg');
}

I have uploaded a image Road.jpg through upload media in wordpress. The file along with its created different sized files are located in the above mentioned path under wp-content. I have decided to use the original sized image which is of 604X270 pixels, but the background image is not being displayed. Am I making any mistake defining the path of the image or is their any mistake in the code itself?

3

3 Answers

0
votes

try to use the whole url:

#main{
    background-image: url(http://your_domain/wp-content/uploads/2015/09/Road-604x270.jpg);/* without '' */
}

instead of

 #main{
        background-image: url('wp-content/uploads/2015/09/Road-604x270.jpg');
    }
0
votes

As you are setting a background image, make sure that container has some height, or not empty.

0
votes

Try use the whole url like Aminesrine said, but check the name of your image, because you said that has uploaded a image named Road.jpg and want to use the original size, then try:

#main{
    background-image: url(http://domain/wp-content/uploads/2015/09/Road.jpg)
}