Links are found in nearly all Web pages. Links allow users to click their way from page to
HTML Tutorial A Link within this website.
Google Link to a website.
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:
The HTML code for a link is simple. It looks like this:
The href attribute specifies the destination of a link.
which will display like this: Visit QcTutorials
Clicking on this hyperlink will send the user to QcTutorials homepage.
Hint: The "Link text" doesn't have to be text. You can link from an image or any other
The target attribute specifies where to open the linked document.
The example below will open the linked document in a new browser window:
The name attribute specifies the name of an anchor.The name attribute is used to create a
bookmark inside an HTML document.
Note:The upcoming HTML5 standard suggest using the id attribute instead of the name
attribute for specifying the name of an anchor.Using the id attribute actually works also
for HTML4 in all modern browsers.
Bookmarks are not displayed in any special way. They are invisible to the reader.
A named anchor inside an HTML document:
Create a link to the "Useful Tips Section" inside the same document:
Or, create a link to the "Useful Tips Section" from another page:
Note: Always add a trailing slash to subfolder references. If you link like this:
href="http://www.qctutorials.com/learning/html", you will generate two requests to the server,
the server will first add a slash to the address, and then create a new request like this:
Hint: Named anchors are often used to create "table of contents" at the beginning of a
large document. Each chapter within the document is given a named anchor, and links to each of
these anchors are put at the top of the document.
Hint: If a browser does not find the named anchor specified, it goes to the top of the
document. No error occurs.
An image as a linkHow to use an
image as a link.
Link to a location on the same
pageHow to link to a bookmark.
Break out of a frameHow to
break out of a frame (if your site is locked in a frame).
Create a mailto linkHow to link
to a mail message (will only work if you have mail installed).
Create a mailto link 2Another
Your Query was successfully sent!