Normally, clicking a link opens the linked page in the same browser window. To alter this behavior, you can set a different target for the link using the target attribute.
The target attribute determines the location where the linked document will open.
Possible values for the target attribute include:
<a href=”https://code7school.com/” target=”_blank”>Visit code7school.com!</a> |
Both examples above employ an absolute URL (a complete web address) within the href attribute.
A local link (a link to a page within the same website) is designated with a relative URL (excluding the “https://www” portion):
Example
<h2>Absolute URLs</h2> <p><a href=”https://www.w3.org/”>W3C</a></p> <p><a href=”https://www.google.com/”>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> |