Course Content
HTML Forms
HTML forms are an essential part of web development and provide a way for users to input and submit data to a server. Forms allow users to enter data such as text, numbers, checkboxes, radio buttons, and more. When a user submits a form, the data is typically sent to a server for further processing.
0/6
HTML Graphics
HTML provides various ways to incorporate graphics into web pages.
0/2
HTML Media
HTML provides built-in support for embedding and displaying various types of media content on web pages.
0/5
HTML APIs
HTML APIs, also known as browser APIs or web APIs, are a set of interfaces and methods provided by web browsers to interact with and manipulate web content, access device features, and perform various tasks. These APIs are implemented in JavaScript and are accessible to web developers when creating web applications. Here are some commonly used HTML APIs:
0/5
HTML Examples
Creating a Simple Web Page, Adding Links and Images and more
0/4
HTML5 for Free | HTML5 – Unleashing the Potential of Web Development
About Lesson

In HTML, file paths are used to specify the location of files, such as external CSS stylesheets, JavaScript files, images, or other HTML files, that are referenced within an HTML document. There are three types of file paths commonly used in HTML:

  1. Absolute File Paths:
    An absolute file path specifies the complete path to a file, starting from the root directory of the file system. It includes the full URL or the absolute file path on the local machine. For example:
  • Absolute URL: <script src="https://www.example.com/scripts/script.js"></script>
  • Absolute file path: <link href="C:/path/to/styles.css" rel="stylesheet">

Absolute file paths are useful when referencing files from external sources or when you need to specify an exact file location.

  1. Relative File Paths:
    A relative file path specifies the location of a file relative to the current HTML document. It doesn’t include the full URL or the complete file path. Relative file paths are commonly used when referencing files within the same website or directory structure. There are different ways to specify relative file paths:
  • Same directory: <img src="image.jpg">
  • Subdirectory: <img src="images/image.jpg">
  • Parent directory: <img src="../image.jpg">
  • Up multiple levels: <img src="../../image.jpg">

Relative file paths are more flexible and portable, as they can be used across different environments without the need to update the file paths.

  1. Root-Relative File Paths:
    Root-relative file paths are similar to relative file paths but are defined relative to the root directory of the website. They start with a leading forward slash (“/”) and are commonly used when referencing files from different directories within the website. For example:
  • <img src="/images/image.jpg">
  • <link href="/styles/styles.css" rel="stylesheet">

Root-relative file paths are useful when you want to specify the path relative to the website’s root directory, regardless of the current page’s location.

It’s important to ensure that file paths are correctly specified and match the actual file locations to ensure proper file retrieval and linking within the HTML document. Testing file paths across different environments and considering the directory structure of your website is crucial for successful file path references in HTML.

Join the conversation