Javascript AJAX jQuery HTML PHP Example MORE

HTML File path with example

In HTML, File Path Describe or Specifies to the Location of a file(Example.Doc, Image etc.) in a webside folder.

Generally File Path used to Link the following file like:

  1. Web Pages(About.html,contact.html)
  2. Images
  3. CSS File
  4. Javascipt File

File Path are two types:

  1. Absolute File Path
  2. Relative File Path

Absolute File Path

Absolute file path is the full URL for the file.

Example:localhost/Image.jpg(In local)

Example:www.studentstutorial.com/Image.jpg(In Online Server)

Example

<!DOCTYPE html> 
<html> 
    <head> 
        <title>Absolute file path</title> 
    </head> 
    <body> 
        <img src="https://studentstutorial/images/my_image.jpg"
        alt="My Image" style="width:400px"> 
    </body> 
</html>

Run it yourself

Relative File Path:

It specifies the path of the file relative to the location of the current web page file. Relative Path is recommended because there is no need to change the URL even is the website domain name is change.

    <!DOCTYPE html> 
        <html> 
            <head> 
                <title>Relative file path</title> 
            </head> 
            <body> 
                <h2>File present in the same folder</h2> 
                <img src="images/my_image.jpg" alt="My Image" style="width:400px"> 
            </body> 
   </html>  

Run it yourself