HTML

Home

Tutorials

Go to tag:

 

Name

Anchor

Description

Creates a hyperlink.  When clicked on, the browser is directed to another URL.  The URL can be a document in the same website or from a different website altogether.

Attributes

HREF

Specifies the URL to link to.  To link to a file on the same site use the local path e.g. href="index.html" or href="folder/contents.html".  You can also use dots to link to a document in the parent folder e.g. href="..\document.html".  To link to another site, use the full URL e.g.: href="https://www.martin2k.co.uk".

NAME

Used on its own, this attribute marks the text as being a bookmark.  When the user click on a link to go to the bookmark, they are taken to that part on the page.  E.g. this link will take you to the top of this page because the Name heading has been marked as being a bookmark.  When creating a link to a bookmark, prefix the bookmark name with a '#' character. E.g. <a href="#Name">link to 'Name' bookmark</a>.

TARGET

Specifies the target frame.  As well as name of frames, there are predefined values that can be used to open the page in a specific location:

Value Description
_blank Open in new window
_parent Open in parent frame
_self Open in same frame
_top Open in current window, regardless of frames used

TITLE

This attribute creates a tooltip when the user hovers the mouse cursor over the link.

Example

Code

<a href="https://www.martin2k.co.uk" target="_blank" title="martin2k HomePage">martin2k</a>

To create a bookmark:

<a name="bookmarkname">Text</a>

Generates

martin2k

© Martin Allen 1999 - 2018.  Last updated Sunday 11 February 2018 14:26 +0000.