Currently, my HTML uses absolute file paths because I can not seem to get the hang of relative file paths. For instance, on my Contact page, I use absolute file paths for all of the images, which looks like this:
How do I make a relative file path that is a bit more manageable. I know that you can do things like images/, ./images/, or ../images/, but I am a bit confused on which one I should use, because I tried them all and none of them seem to work. In my CSS, I can use relative file paths just fine:
The relative files in your CSS file work fine because your CSS file is located in wp-content/themes/starkers/ and your images/ folder is in that same directory.
Currently, my HTML uses absolute file paths because I can not seem to get the hang of relative file paths. For instance, on my Contact page, I use absolute file paths for all of the images, which looks like this:
How do I make a relative file path that is a bit more manageable. I know that you can do things like
images/,./images/, or../images/, but I am a bit confused on which one I should use, because I tried them all and none of them seem to work. In my CSS, I can use relative file paths just fine:But it does not seem to be that easy in HTML. Any help would be greatly appreciated. Thank you.
src="/image.jpg"== the root folder of the websitesrc="image.jpg"== same folder as current pagesrc="../image.jpg"== one folder up from current pagesrc="../../image.jpg"== two folders up from current page, etcIn your first example, you could do two different things:
Or,
The relative files in your CSS file work fine because your CSS file is located in wp-content/themes/starkers/ and your
images/folder is in that same directory.Also. Instead of saying ../images you can often simply say /images. That mean start at the root.
Thank you muchly, kind sirs. @TheDoc, thanks for explaining the different steps for
img src.