Technology Networking & Internet

Basics of HREF

    The Anchor Tag

    • The href property always accompanies an anchor tag. HTML links are between the starting "<a>" tag and the ending "</a>" tag. The text between these two tags are underlined and highlighted with the color-coded link text. The color coding indicates to the user that the text is a link. The anchor tag uses the href property to determine where to send the user. The URL can be a Web page on the local domain or an external page on a different domain. The href property can also send a user to a different section of the page using bookmark anchors. These anchors are specified using the "#" prefix in the URL.

    HREF Definition

    • The href property is located directly after the "a" notation in the anchor tag. The following code is an example of an anchor tag code:

      <a href="/links/?">Click here.</a>

      When the user clicks the "Click here" text, the browser is redirected to the "" site. Some programmers use a title property within the anchor tag, but the above code is the very minimum requirement for a functional anchor tag. The href property is an essential part of the tag, since it provides the redirection URL.


    • Bookmarks are used in the href property to tell the browser to "jump" to a location within the current page. The bookmark URL contains the hash mark prefix. The below code jumps to a location within the page:

      <a href="/links/?u=#bookmark">Jump to my bookmark</a>

      To use a bookmark, the paragraph requires an anchor tag with the "name" property. The following code is place in a location to where the browser jumps:

      <a name="bookmark">Read this text</a>

      These two tags work together to allow users to jump between locations within one page. The text within the anchor text is underlined and colored like other external links on the page.

Leave a reply