Links
In HTML, links (also known as "Hyperlinks") are what enables visitors to click through to another web page (or other URL). The visitor usually clicks on linked text or a linked image and that's what triggers the loading of the linked document.
To create a link in HTML, you use the HTML <a>
tag, also known as the "anchor" tag. The anchor tag is represented by the letter "a". Therefore, the syntax goes something like this <a href="...some URL...">anchor text</a>
.
Here's an example:
Source Code | Result |
---|---|
Check out Rob Roy Glacier! |
Open Link in New Window
If you want the page to open in a new window, you can add target="_blank"
to your code. Like this:
Source Code | Result |
---|---|
Here's another glacier in New Zealand: Fox Glacier |
Named Anchors
You can make the browser jump to a certain spot in the page by using a named anchor. To do this, you use the document URL, followed by a #
, followed by the anchor name. The anchor name must exist somewhere in the target document. To place an anchor into the target document, use <a name="..."></a>
(and replace ...
with a name of your choice).
In the example below,
Source Code | Result |
---|---|
Jump down to My Named Anchor .......... .......... .......... My Named Anchor |
Image Links
You can place the link code around an image too. This will link the image to the URL specified. Like this:
Source Code | Result |
---|---|
HTML Link Generator
You can also use this HTML link generator to generate the HTML code for your hyperlinks.