HTML File Paths

HTML File Paths (HTML文件路径)

A file path defines the location of a file in a web site’s folder structure. (文件路径定义了文件在网站文件夹结构中的位置。)

A file path is used when we link to such external files like:

  • web pages (网页)

  • images (檢查圖像: )

  • JavaScripts (文件夹没有找到。)

  • style sheets (網頁樣式表)

There exist absolute and relative file paths. (存在绝对和相对文件路径。)

Absolute File Paths

Absolute File Paths (绝对文件路径)

An absolute file path is the URL to access an internet file. (绝对文件路径是访问Internet文件的URL。)

Example of an absolute file path:

<!DOCTYPE html>
<html>
 <head>
   <title>Title of the document</title>
 </head>
 <body>
   <h2>Absolute File Path Example</h2>
   <img src="https://www.slrlounge.com/wp-content/uploads/2019/11/Sea-Thru-Underwater-Photography-Algorithm-SLR-Lounge_0001-1000x675.jpg" alt="Sea" style="width:300px">
 </body>
</html>

Relative File Paths

Relative File Paths (相对文件路径)

A relative file path mentions a file that is relative to the current page. In the example below, the file path points out a file in the images folder that is located at the root of the current web:

Example of a relative file path:

<!DOCTYPE html>
<html>
 <head>
   <title>Title of the document</title>
 </head>
 <body>
   <h2>Relative File Path Example</h2>
   <img src="/build/images/smile-small.jpg" alt="Smile" width="290" height="260">
 </body>
</html>


请遵守《互联网环境法规》文明发言,欢迎讨论问题
扫码反馈

扫一扫,反馈当前页面

咨询反馈
扫码关注
返回顶部