Reputation: 33
I am editing a website and in the Cascading Style Sheet files I have come across this:
background-image: url(../images/research_icon.png);
However nothing is there if I type:
www.(website).com/images/research_icon.png
I was wondering if the .. is affecting the location of the image? Help? (Also the image is there because the webpage displays it.)
Upvotes: 1
Views: 805
Reputation: 769
The .. doesn't change the location of the image. It just sets a relative path to the image.
The ../
means the folder is one level up from the current location and then down into the /images/
folder.
It is just setting a reference location to link/load the image for the stylesheet. It makes no edits to the images itself.
Quick overview of how the ../
and ./
and /folder/folder/other/images
can be found at the bottom of this page. It is pretty stright forward. imgName.jpg
is in your current directory. A /folder/image.jpg
means the image is one folder down from your location. ../images/imagename.jpg
means the image is one folder up and the in the /images/
folder from your current directory.
You can find and set the relative path to the image using that method once you find the actual location of your image.
You could also define the abolsure path which would something like url(http://www.yoursite.com/images/logo.jpg);
Either one is correct and will work. Each with advantages and disadvantages. Relative paths are more flexible if you're going to duplicate files or move locations at a later date. Absolute paths guarantee that whatever is at the URL is loaded no matter where the stylesheet is located. If that file ever goes down or move though you're out of luck until you find the new absolute path.
Upvotes: 1
Reputation: 939
Right-click the image on the site and click "Copy Image URL"
It's location is everything after the domain name "www.domain.com/"
Upvotes: 1
Reputation: 744
The image folder is likely in the css folder itself. So try www.(website).com/css/images/research_icon.png
. Although the css folder may be in another folder itself, hard to say.
You should also be able to right click on the image and inspect it to see its full path.
Upvotes: 0