Technology Programming

How to Link One Page to Another in HTML

Hyperlink HTML

Users use Links / Hyperlinks to move on any server anywhere in the world from one page to another. There are two ends of each link called a direction and anchors. The link/hyperlink starts at the source anchor and points to the destination anchor, which can be any web resource (e.g. image, video clip, audio or HTML document, or element within the document itself, etc.).

By default of links:

  • An unopened link is underlined and blue.
  • An opened link is underlined and purple.
  • An active link is underlined and red.

However, you can overwrite these defaults using CSS

Hyperlinks are specified in HTML using the <a> tag.A hyperlink or link might be a word, word group, or photo.

<a href=”URL“>Text link</a>

The href attribute specifying the destination anchor address in the source anchor

Examples on HTML Hyperlink

<a href=https://www.bibloteka.com/>Learning Website</a>

<a href=https://www.google.com/>Search Google</a>

The target attribute informs your browser where the connected document should be opened. There are four defined targets. Each target starts with an underscore ( _ ):_blank_self_parent_top

Examples on Target Attribute of Hyperlink

<a href=https://www.google.com/ target=_blank>Google</a>

Creating Bookmark Anchors

The (id) attribute is always used to create a bookmark inside a web page in the following way

The HTML5 standard suggests using the id attribute instead of the name attribute for specifying the name of an anchor.

Examples on Creating Bookmark Anchors

<a href=#Cat><img src=Cat-thumb.jpg alt=Cat></a>

<img src=“Cat.jpg alt=“White Cat id=“Cat>

OR

<a href=#cat><img src=“cat-thumb.jpg alt=“Cat”></a>

<img src=“Cat.jpg alt=“White Cat name=“Cat>

Placing files available for download is done in exactly the same fashion as placing text links, just point the destination URL to the file you want to be available for download.

Examples on Creating Download Hyperlinks

Clicking a hyperlink that points to a PDF file or Image file won’t cause it to download to your hard drive directly. It will only open the file in your web browser. Further, you can save it to your computer.

In this case, it’s a Zip file called test.zip :

<a href=downloads/tutorial.zip>Download Zip file</a>

<a href=downloads/tutorial.pdf>Download PDF file</a>

<a href=downloads/cat.jpg>Download Image file</a>

See Also
HTML Attributes
Doctype HTML