www.pickatutorial.com Computer Tutorials
Top eBooks: C/C++ | C# | Android | Mathematics | Database | Cloud | Graphics | Networking | Oracle | Hardware | AI
Top Tutorials: C/C++ | C#.NET | PHP MySQL | Java | Java Script | jQuery | HTML | xHTML | HTML5 | VB Script| CSS
Lessons Relative and Absolute Paths in HTML Bookmark and Share
Tutorial Home
Lesson 1
Lesson 2
Lesson 3
Lesson 4
Lesson 5
Lesson 6
Lesson 7
Lesson 8
Lesson 9
Lesson 10
Lesson 11
Lesson 12
Lesson 13
Lesson 14
Lesson 15
Lesson 16
Lesson 17
Lesson 18
Lesson 19
Lesson 20
Lesson 21
Lesson 22
Lesson 23
Lesson 24
Lesson 25
Lesson 26
Lesson 27
Lesson 28
Lesson 29
Lesson 30
Lesson 31
Lesson 32
Lesson 33
Lesson 34
Lesson 35
Lesson 36
When adding links and images to our web pages, we can specify their location or path in one of the two ways namely; absolute path and relative path.

Absolute Paths:

Absolute path refers to the locatoin of the file with reference to the root directory, in the case of a file system, or full web address in the case of a domain name.

For example:



The first one is the example of an absolute path of the image file in the local file system and the second one is the example of an absolute path of an image file on a web server.

Relative Paths:

Relative path refers to the location of the file with reference to the current directory. For example if you are currently working in a directory named myWeb and want to refer to the image file named logo.jpg located in a directory named images stored inside myWeb directory, you can point to it using its relative path as under:


In this case you need not to specify full file system path.

In the case of a web server if your html file is on the root and your image file logo.jpg is strored in the images folder, you can point to it using its relative path as under:


Please note the difference between referencing a file on a file system and on a web server. On a file system \ is used and on a web server / is used. While writing HTML you will most often encounter web server / type paths. Please don't mix them as the file system example has been given just as a reference.
Next >>> Lesson No. 20: Image Handling in HTML

Home - Advertise - Contact - Disclaimer - About Us
© Since 2006 pickatutorial.com -- All Rights Reserved.