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 anchor tag. The anchor tag is represented by the letter "a". Therefore, the syntax goes something like this
Here's an example:
In the example below,
To create a link in HTML, you use the HTML anchor tag. The anchor tag is represented by the letter "a". Therefore, the syntax goes something like this
anchor text
.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 addtarget="_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
(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 |
---|---|
|
0 comments:
Post a Comment