Anchor HTML Tutorial

The HyperText Markup Language (HTML) anchor tag provides a method for connecting page sections, media files, other websites and generating email because it works with both hyperlinks and anchors. Most websites have various kinds of anchor links, according to the needs of the content. Using the "" HTML tag, you too can make use of this element to enhance your own web documents.

Linking Within a Page

Linking Text

    You can link to an outside URL that directs the visitor to a media file or another website. To do this, obtain the full web address that you want to link to and pick the text that you want to turn into a link. Now, encompass the chosen content within the "" anchor tags and type in the address after the "href" attribute. As an example, to set the destination address to Apple, Inc., type:
    Apple, Inc.

Linking Images

    In addition to text, graphics can also be used to create connections, such as navigational buttons. To create the graphical link, upload your intended image (in JPG or GIF format) to a server on your web host and make a note of the location. Keep all files in the same directory to make things easier. Enter the graphic's location within the image source tag as such:

    Next, create a link to the file by surrounding it with the usual anchor tags. For instance:

Create an Email Address Link

    Mail addresses can also be linked using the "mailto" attribute in conjunction with the anchor tag. This type of feature is a great tool to have on your website because, once clicked, the visitor's mail application automatically launches a new message with your email address already in the "To" field. To create an email address link, enter the expected open and close anchor tags around the chosen text, follow it with the "mailto" attribute, type in a colon and fill in your email address. To illustrate:

Blog Archive