You are on page 1of 1

Avanti Bhondwe D16 49

Experiment 2

Aim: Design a web page using HTML5, containing images with relative link and absolute link.

Theory:
Relative Links: In HTML5, relative links are specified using paths that are relative to the current
location of the HTML document. They are convenient for linking resources such as images,
stylesheets, and other web pages within the same website or directory structure. Relative links
are concise and flexible, as they adapt automatically to changes in file locations or directory
structures. They help maintain the organization of a website's files and simplify maintenance
tasks. Relative links do not include the full URL or domain name, making them shorter and more
manageable. However, they may become problematic when linking to resources outside the
current website or directory.

Absolute Links: Absolute links in HTML5 provide the complete URL or path to a resource,
including the protocol (e.g., HTTP, HTTPS) and domain name. They specify the exact location of
the linked resource, regardless of the current document's location or directory structure.
Absolute links are essential for linking to external websites, resources hosted on different
servers, or specific locations within the current website. While absolute links ensure the
reliability and accuracy of resource access, they may result in longer and less flexible code.
Additionally, if the URL of the linked resource changes, all absolute links referencing it must be
updated manually. Example: Visit Example Website

Relative links are suitable for internal resources within the same website or directory, offering
flexibility and ease of maintenance. On the other hand, absolute links provide precise
references to external resources or specific locations within the website, ensuring reliability but
potentially increasing code complexity.

Conclusion:
The experiment explains the functionality of relative and absolute links in HTML5
web pages. Relative links offer flexibility by referencing resources within the same directory or
website structure, aiding in maintenance and organization. They adapt dynamically to directory
changes. Absolute links provide precise resource references with full URLs, ensuring reliable
access regardless of document location. Understanding these link types empowers developers
to optimize navigation and resource access based on project needs.

You might also like