html文件路径_HTML文件路径

html文件路径

An HTML file path specifies the location of a file in the website folder. The file paths are very similar to an address of file for the web browser. With the HTML file paths, one could link any external file or resource to the HTML file.

HTML文件路径指定文件在网站文件夹中的位置。 文件路径与网络浏览器的文件地址非常相似。 使用HTML文件路径 ,可以将任何外部文件或资源链接到HTML文件。

File paths are used on the HTML webpages to link the external files such as a Web page, an image, a style sheets or a JavaScript.

HTML网页上使用文件路径来链接外部文件,例如网页,图像,样式表或JavaScript。

In HTML, the file paths are of two different types:

在HTML中,文件路径有两种不同的类型:

  1. Absolute file paths

    绝对文件路径

  2. Relative file paths

    相对文件路径

1)绝对文件路径 (1) The absolute file paths)

The absolute file path specifies the full address or says the URL to access that internet file.

绝对文件路径指定完整地址,或说访问该Internet文件的URL。

An example to illustrate the absolute file path is as follows,

一个说明绝对文件路径的示例如下,

    <img src="https://www.includehelp/htmlpage.jpg"/>

2)相对文件路径 (2) The relative file paths)

The relative file paths specify the path of the required file relative to the location of the current web page. When one is using the relative file paths, then his web pages would not be bounded to the current base URL. The links, they will work on localhost as well as on the current public domain.

相对文件路径指定相对于当前网页位置的所需文件的路径。 当使用相对文件路径时,他的网页将不会绑定到当前的基本URL。 这些链接将在localhost和当前公共域上运行。

An example to illustrate the relative file path is as follows,

一个说明相对文件路径的示例如下,

    <img src="/images/yourimagename.jpg" />

The file paths in the HTML document are specified as,

HTML文档中的文件路径指定为

    <img src="imagename.png" />

Such file links are used when the required file is present in the same folder with the HTML document. Here no need to specify the folder or any other location details.

当所需文件与HTML文档位于同一文件夹中时,将使用此类文件链接。 此处无需指定文件夹或任何其他位置详细信息。

    <img src="foldername/imagename.jpg" >

Such file links are used when the required file is present in some folder named as foldername. This folder foldername is present within the folder in which the HTML document is present or the current folder.

当所需的文件存在于名为foldername的某个文件夹中时,将使用此类文件链接。 该文件夹的文件夹名称位于存在HTML文档的文件夹或当前文件夹中。

    <img src="/foldername/imagename.jpg" />

Such file links are used the required file is present in a folder named as the foldername. This folder is present at the root folder of the webpage.

使用此类文件链接,所需的文件位于名为foldername的文件夹中。 该文件夹位于网页的根文件夹中。

    <img src="C:/user/desktop/.../imagename.jpg" />

Here the full address of the image is specified within the source attribute. In such a file path, the complete path or the location has to be specified.

在此,图像的完整地址在source属性中指定。 在这样的文件路径中,必须指定完整路径或位置。

One has to remember to use a proper URL or location of the file, the file name, the image name, or else the browser would not display the required file on the webpage. Instead of the required file, anything would be shown.

必须记住要使用正确的URL或文件的位置,文件名,图像名,否则浏览器将不会在网页上显示所需的文件。 代替所需的文件,将显示任何内容。

Often it is asked to used the relative file paths in the HTML document so that the code would be independent of the URL.

通常要求使用HTML文档中的相对文件路径,以使代码独立于URL。

翻译自: https://www.includehelp.com/html/html-file-path.aspx

html文件路径

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值