1/22
Looks like no tags are added yet.
What is a file path?
A string that describes the location of a file within a website's folder structure.
How do file paths function across different operating systems?
They are consistent, meaning file paths used during development on one OS will function the same when deployed to another.
Which HTML elements utilize file paths?
Images (), anchor tags (), stylesheet links (), and JavaScript script sources (
What is an absolute path?
It provides the full address to a resource, including the protocol, domain name, and the entire path to the file.
What does an absolute path start with?
It starts with https:// or http://.
When should you use an absolute path?
When referencing external resources or specifying full URLs for canonical links.
When should you avoid using an absolute path?
During local development, as it ties files to a specific domain.
What is a relative path?
It specifies a file's location in relation to the current HTML file's directory.
What does a relative path start with?
Nothing, a folder name, or ../.
When should you use a relative path?
For local projects or deployments where the folder structure is expected to remain consistent.
What is a root-relative path?
It starts from the website's root directory, regardless of the current HTML file's location.
What does a root-relative path start with?
A forward slash (/).
When should you use a root-relative path?
When all files are organized under a common root on a web server.
What is a protocol-relative path?
It starts with // and allows the browser to automatically use the same protocol (HTTP or HTTPS) as the current page.
When should you use a protocol-relative path?
When you want a resource to load over HTTPS on an HTTPS page and HTTP on an HTTP page.
What is a modern practice regarding protocol-relative paths?
They are less commonly used now as modern web development favors explicitly using HTTPS for all resources.
What is a common use for a relative path?
Local files within a project.
What is a common use for a root-relative path?
Larger sites with deeply nested files, when consistency from the project's root is desired.
What should you avoid with root-relative paths?
They do not work reliably when opening local files directly in a browser.
What is an example of an absolute path?
What is an example of a relative path?
What is an example of a root-relative path?
What is an example of a protocol-relative path?