Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pick images of root folder from sub-folder

Let's say following is the directory structure of my website : DIR STRUCTURE

Now in index.html I can simply refer images like:

<img src="./images/logo.png"> 

But I want to refer the same image from sub.html. What should be the src?

like image 474
Moon Avatar asked Sep 07 '10 00:09

Moon


People also ask

Is a root folder located in a subfolder?

The root directory contains all other folders in the drive or folder, and can, of course, also contain files. You can visualize this with an upside-down tree where the roots (the root folder) are at the top and the branches (subfolders) fall below; the root is what holds together all of its lower items.

How do I see the root directory?

Type “echo %SYSTEMROOT%" at the command prompt and press “Enter.” The result of this search is the root folder for Microsoft Windows.

How do you reference a sub folder in HTML?

To reference a file in a subdirectory, write the directory name in front of the path, plus a forward slash, e.g. subdirectory/my-image. jpg . To link to a target file in the directory above the invoking HTML file, write two dots. So for example, if index.


1 Answers

../images/logo.png will move you back one folder.

../../images/logo.png will move you back two folders.

/images/logo.png will take you back to the root folder no matter where you are/.

like image 186
Moses Avatar answered Oct 12 '22 11:10

Moses