Anchor


Part A | Part B | Part C

The tag defines a hyperlink, which is used to link from one page to another. An anchor can be used in three different ways:


Attributes of Anchor Tag:

  1. href (link to object)
  2. id (link from object)
  3. ref (relationship between objects)
  4. hreflang - specify language of target document
  5. media - define media
  6. target
The most important attribute of the element is the href attribute, which indicates the link’s destination.




Part A


By default, hyperlinks will appear as follows in all browsers:

You need customize your own colors for your links, hover links, active links, and visited links.

Tips of Using Anchor Tag:



Different Anchor Usage Between HTML 4.01 and HTML5

In HTML 4.01, the tag could be either a hyperlink or an anchor. In HTML5, the
tag is always a hyperlink, but if it doesn't have href attribute, it is only a placeholder for a hyperlink. HTML5 has some new attributes, and some HTML 4.01 attributes are no longer supported.

Named Anchors in HTML5

The traditional way to create named anchors (bookmarks) on a page was to use
Top of page. If you are working in HTML5 you'll find that your html validator will indicate this as an error, although it will still work in current browsers. In an HTML5 document, you need give the anchor/bookmark an ID and target that in your link.

Top of page




Part B


Linking to a Specific Place in a Document
You can use the Properties inspector to link to a particular section of a document by first creating named anchors. Named anchors let you set markers in a document, which are often placed at a specific topic or at the top of a document. You can then create links to these named anchors, which quickly take your visitor to the specified position. Creating a link to a named anchor is a two-step process. First, create a named anchor; then create a link to the named anchor.

To Create a Named Anchor:
  1. In the Document window's Design view, place the insertion point where you want the named anchor
  2. Do one of the followings

In the Anchor Name field, type a name for the anchor. For more information, see Setting the Named Anchor option.
The anchor marker appears at the insertion point.

Note: If you do not see the anchor marker, choose View > Visual Aids > Invisible Elements.

Top of page




Part C


To Link to a Named Anchor:
  1. In the Document window's Design view, select text or an image to create a link from.
  2. In the Link text box of the Property inspector, type a number sign (#) and the name of the anchor. For example:
  1. In the Document window's Design view, select text or an image you want to link from.
  2. Do one of the following:


Top of page