Pages

Monday, June 28, 2010

:: HTML Elements Part 6 ::

Links are found in nearly all Web Pages. Links allow users to click their way from page to page.

HTML Hyperlinks(Links)

A hyperlink (or link) is a word, group of words, or image that you can click on to jump to a new document or a new section within the current document.When you move the cursor over a link in a Web page, the arrow will turn into a little hand.Links are specified in HTML using the <a> tag.The <a> tag can be used in two ways:

  1. To create a link to another document, by using the href attribute
  2. To create a bookmark inside a document, by using the name attribute
HTML Link Syntax

The HTML code for a link is simple. It looks like this:

<html>
<head>
<title> The sixth lesson </title>
</head>
<body>
<a href="url">Link text</a>
</body>
</html>

The href attribute specifies the destination of a link.

HTML Links-The target Attribute

The target attribute specifies where to open the linked document.The example below will open the linked document in a new browser window:

Example :

<a href="http://www.mutak.com/" target="_blank">Mutak Pages!</a>

HTML Links - The name Attribute

The name attribute specifies the name of an anchor.The name attribute is used to create a bookmark inside an HTML document.Bookmarks are not displayed in any special way. They are invisible to the reader.

Example

A named anchor inside an HTML document:

<a name="tips">New Section</a>

Create a link to the "New Section" inside the same document:

<a href="#tips">New Section</a>

Or, create a link to the "New Section" from another page:

<a href="http://www.mutak/links.htm#tips">New Section</a>

In conclusion , the HTML Links requires both start and end tags. This syntax can be added in body section. Forget to use end tag can make all html pages be hyperlinks.


0 comments: