Reputation: 524
I cannot load image as a background, my image located at
img/my_images.jpg
and this is my css code look like
.background-content
{
background-image: url(img/my_images.jpg);
background-position: center;
}
the css file is located at
css/my_style.css
but everytime I move the image into the same folder as css, it does load the image perfectly. is it impossible to load image from outside folder of css
thanks for the help.
sincerely, gema.
Upvotes: 0
Views: 268
Reputation: 76
Marcus is correct you likely need to go back a directory with ../images/you pic.jpg
Upvotes: 0
Reputation: 1882
The image loads relative to where the css is located. So your image would have to be in
css/img/my_images.jpg
I'm guessing you want
background-image: url(../img/my_images.jpg)
I prefer to do everything from the root
background-image: url(/img/my_images.jpg)
Upvotes: 1
Reputation: 61056
I'm guessing here, but you probably just need to use the "up one level" syntax:
background-image: url(../img/my_images.jpg);
This gets you up into the parent folder of /css/, and then back down into /img/.
Upvotes: 2
Reputation: 6717
Change this
background-image: url(img/my_images.jpg);
to this
background-image: url(../img/my_images.jpg);
Upvotes: 1