Links

The <a> anchor tag is one of the most important HTML tags. It is used to create a link from one page to another. The most basic implementation of an HTML link is as follows:

<a  href=""></a>

The href attribute of the anchor link tag tells the browser where to send the website visitor when the link is clicked. The next example shows the target attribute.

<a  href="" target=""></a>

The target attribute determines how the browser will open the page defined in the anchor tag. The possible values are _blank, _parent, _self, and _top. _blank will open the link in a new window. _parent will open the link in the parent window, if a frameset is present. _self will open the link in the same window or frame as the link was clicked in. _top will open the link in the topmost frame, using the entire size of the browser window. In many browsers, new can be used in place of _blank as an attribute and has the same effect as _blank.

The name attribute of an anchor tag link can be used to uniquely identify a link.

<a  name=""></a>

The name defined in this attribute can be used by another anchor tag later in the document, or another document to link to the specific location of the named link within the HTML document.

Anchor Tag Link Examples

<a href="http://www.google.com">Google Search</a>

Google Search

<a href="http://www.google.com" target="_blank">Google Search in a New Window </a>

Google Search in a New Window

<a  name="bookmark"></a>
<a  href="#bookmark"></a>

The above is an example of an on page anchor link. Upon clicking on the 2nd link, the page would scroll so the anchor bookmark is at the top of the page.

The <link> tag is used to include create a link to an external resource. In most cases, the external resource is a stylesheet. Here’s a simple example:

<link  href="style.css" rel="stylesheet" type="text/css"  />

The href attribute contains the location of the document to link to. The rel attribute describes the relationship between the current document and the linked document. In this case, the linked document is a stylesheet. The type attribute describes the contents of the linked document.

The <script> tag is used to include javascript code within an HTML document. The javascript code can be written inside the tags within an HTML document, or the code can be in an external javascript file with a .js file extension.

The script tag is used as follows to include an external javascript document:

<script  type="text/javascript"  src="javascript-file.js"></script>
Bookmark and Share

Popularity: unranked [?]