Horje

Absolute URLs vs. Relative URLs

Both examples above are using an absolute URL (a full web address) in the href attribute.

A local link (a link to a page within the same website) is specified with a relative URL (without the "https://www" part).

index.html
Example: HTML
<h2>Absolute URLs</h2>
<p><a href="https://www.w3.org/" target="_blank">W3C</a></p>
<p><a href="https://www.google.com/" target="_blank">Google</a></p>

<h2>Relative URLs</h2>
<p><a href="html_images.asp">HTML Images</a></p>
<p><a href="/css/default.asp">CSS Tutorial</a></p>

Output should be:

Absolute URLs vs. Relative URLs




Type:
html
Category:
Web Tutorial
Sub Category:
HTML Basic
Uploaded by:
Admin