Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML root folder?

Tags:

html

Is there a way to direct a url such as an image location to your root folder and then into a directory from there.

Currently i am using "../" to go back folders but this gets annoying if you have a complex directory tree.

Thanks

like image 852
Caedan Lavender Avatar asked Apr 10 '13 20:04

Caedan Lavender


2 Answers

It is just a single character:

/

For example:

/image.jpg

whatever page you put it in, it refers to the same file, root_folder/image.jpg

like image 86
Jack L. Avatar answered Oct 28 '22 04:10

Jack L.


You can also use <base> to set the base url all urls should be relative to. In general using an absolute path with / is probably prefereable, but <base> may be useful if you have the "root" of your page not on the root of the domain. I.E. example.com/mysite/index.html vs. example.com

https://developer.mozilla.org/en-US/docs/HTML/Element/base

like image 40
Zach Lysobey Avatar answered Oct 28 '22 05:10

Zach Lysobey