View video tutorial

HTML Paths

HTML

HTML file path means location a file going to be accessed.

File Location / File Path


When we need a resource to access we use the location or path for that resource.

We can add external or internal resources to a webpage using path.

There are many resources like audio, video, image, css, script, pdf, html, or any other files are to be linked or added to a page.

Path can be of two types absolute path and relative path.

Absolute path tells full location of a resource starting from root path.

Relative path tells location of the file from the current referencing point or current page regardless website root.

To make code independent it is better to use relative path as much as possible.

Learning with HTML Editor "Try it Now"

You can edit the HTML code and view the result using online editor.

Example

<!DOCTYPE html>
<html>
<head>
    <title>HTML path Example</title>
</head>
<body>
    <!--Example: Html Path-->
    <h1>Absolute Path</h1>
    <p><a href="https://www.w3context.com/html/index.jsp" target="_blank">Link opens in a new window</a></p>
    <h1>Relative Path</h1>
    <p><a href="./basic/html-iFrame.jsp" target="_blank">Link opens in a new window</a></p>

</body>
</html>
Try it Now »

Click on the "Try it Now" button to see how it works.