![]() |
HTML File Paths |
HTML File Path
A file path specifies the location of a file inside a web folder structure. It's like an address of a file which helps the web browser to access the file. File paths are link to external resources such as
- images
- Videos
- Files
- Stylesheets
- Javascript
displaying other web pages etc....
Path and Description
- <img src="picture.jpg"> picture.jpg is located in the same folder as the current page.
- <img src="images/picture.jpg"> picture.jpg is located in the images folder in the current folder.
- <img src="/images/picture.jpg"> picture.jpg is located in the images folder at the root of the current web.
- <img src="../picture.jpg"> picture.jpg is located in the folder one level up from the current folder.
Related Article and Videos
- Absolute File Path
- Relative File Path
Absolute File Path
It describe the full address(url) to access an Internet file.
Example
<!DOCTYPE html>
<html>
<head>
<title>Absolute file path</title>
</head>
<body>
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZPLcqTXPXcw3M8ZjdxS6ZBnvfpCOSPnqssHlnJ1aw0JmX7I8Ah_He6-Af0Qur49xa5_99Wx0XjWCGK5QK8GU_GwKP_HGfb9Kj6Heh9BYFG_F6pPoOGeoJGXFt8iYlXtHkj52LddJXPWQd/s1600/http.jpg" alt="My Image" style="width:400px">
</body>
</html>
Result
![]() |
Kumar Atul Jaiswal |
Relative File Paths
A relative file path points to a file relative to the current page.
In this example, the file path points to a file in the images folder located at the root of the current web:
Example
<!DOCTYPE html>
<html>
<head>
<title>Relative file path</title>
</head>
<body>
<img src="/images/picture.jpg" alt="My Image" style="width:200px">
</body>
</html>
Result
![]() |
Kumar Atul Jaiswal |
In this example, the file path points to a file in the images folder located in the current folder:
Example
<!DOCTYPE html>
<html>
<head>
<title>Relative file path</title>
</head>
<body>
<img src="images/picture.jpg" alt="My Image" style="width:100px">
</body>
</html>
Result
![]() |
Kumar Atul Jaiswal |
In this example, the file path points to a file in the images folder located in the folder one level above
the current folder:
Example
<!DOCTYPE html>
<html>
<head>
<title>Relative file path</title>
</head>
<body>
<img src="../images/picture.jpg" alt="My Image" style="width:100px">
</body>
</html>
Result
![]() |
Kumar Atul Jaiswal |
Video on This Topic :- SooN
Have a Nice Stay Here :- )
0 comments:
Post a Comment
For Any Tech Updates, Hacking News, Internet, Computer, Technology and related to IT Field Articles Follow Our Blog.