1. Understanding URLs in Web Development
Every resource on the World Wide Web—whether a web page, image, stylesheet, or video—is referenced via a Uniform Resource Locator (URL). In HTML, anchor tags () and media sources rely on two fundamental path formats: Relative URLs and Absolute URLs.
2. Absolute URLs
An Absolute URL contains the complete internet address, including the transfer protocol (http:// or https://), domain name, and optional file path.
Browse All Test Series
Search on Google
- Always use absolute URLs when linking to external domains outside your website.
- Must include the protocol (
https://); omitting it causes the browser to treat it as a local subfolder.
3. Relative URLs
A Relative URL specifies a path relative to the current file's location or the website root. It omits the protocol and domain name, making your codebase fully portable across local development (localhost), staging, and production servers.
Relative Path Syntax Rules:
filename.htmlor./filename.html: Target file is located in the same directory as current file.subfolder/filename.html: Target file is located inside a child subfolder.../filename.html: Move up one folder level (parent directory).../../filename.html: Move up two folder levels./images/logo.png(Root-relative): Starts from the root directory of the domain, regardless of where current file lives.
About Us
Student Dashboard