HTML Text Links


Web pages can contain links that take you directly to other pages and even specific parts of a given page. These links are known as hyperlinks.
Hyperlinks allow visitors to navigate between Web sites by clicking on words, phrases, and images. Thus you can create hyperlinks using text or images available on your any web page.
In this tutorial you will learn how to create text links between the different pages of your site, links within pages of your sites, and how to link to other sites ( or external sites). If you want to know more about URL then check Understanding URL Tutorial.

Linking Documents - The <a> Element:

A link is specified using the <a> element. This element is called anchor tag as well. Anything between the opening <a> tag and the closing </a> tag becomes part of the link and a user can click that part to reach to the linked document.
Following is the simple syntax to use this tag.
<a href="Document URL" attr_name="attr_value"...more attributes />

Anchor Attributes:

Following are most frequently used attributes for <a> tag.
  • href: specifies the URL of the target of a hyperlink. Its value is any valid document URL, absolute or relative, including a fragment identifier or a JavaScript code fragment.
  • target: specify where to display the contents of a selected hyperlink. If set to "_blank" then a new window will be opened to display the loaded page, if set to "_top" or "_parent" then same window will be used to display the loaded document, if set to "_self" then loads the new page in current window. By default its "_self".
  • name & id: attributes places a label within a document. When that label is used in a link to that document, it is the equivalent of telling the browser to goto that label.
  • event: attributes like onClickonMouseOver etc. are used to trigger any Javascript ot VBscript code.
  • title: attribute lets you specify a title for the document to which you are linking. The value of the attribute is any string, enclosed in quotation marks. The browser might use it when displaying the link, perhaps flashing the title when the mouse passes over the link.
  • accesskey: attribute attribute provides a keyboard shortcut that can be used to activate a link. For example, you could make the T key an access key so that when the user presses either the Alt or Ctrl key on his keyboard (depending on his operating system) along with the T key, the link gets activated.

A Simple Example:

<a href="http://www.tutorialspoint.com/" target="_blank" >TP Home</a> |
<a href="http://www.amrood.com/" target="_self" >AMROOD Home</a> |
<a href="http://www.change-images.com/" target="_top" >Change Images Home</a>
This will produce following result, Click and come back to proceed with rest of the tutorial:
Tutorials Point | AMROOD | Change Images

Base Path for Links:

It is not required to give a complete URL for every link. You can get rid of it if you will use <base> tag in your header. This tag is used to give a base path for all the links. So your browser will concatenate given relative path to this base path and will make a complete URL.
For example we have used following base tag in all the pages at tutorialspoint.com:
<head>

<base href="http://www.tutorialspoint.com/">

</head>
So now if you will use <a href="/html/index.htm" then it will be considered as <a href="http://www.tutorialspoint.com/html/index.htm".

Linking to a Page Section:

You can create a link to a particular section of a page by using name attribute. Here we will create three links with-in this page itself.
First create a link to reach to the top of this page. Here is the code we have used for the title heading HTML Text Links
<h1>HTML Text Links <a name="top"></a></h1>
Now you have a place where you can reach. To reach to this place use the following code with-in this document anywhere:
<a href="/html/html_text_links.htm#top">Go to the Top</a>
This will produce following link and you try using this link to reach to the top of this page:
Go to the Top
NOTE: Here we are using relative path. You can give complete URL and then # and then link name eg. http://www.tutorialspoint.com/html/html_text_links.htm#top
You can use this type of URL in any other page to reach directly to a particular section.

Setting Link Colors:

You can set colors of your links, active links and visited links using linkalink and vlink attributes of <body> tag. But it is recommended to use CSS to set colors of links, visited links and active links.
Following is the example we have used for our web side tutorialspoint.com
a:link    {color:#900B09; background-color:transparent}
a:visited {color:#900B09; background-color:transparent}
a:active  {color:#FF0000; background-color:transparent}
a:hover   {color:#FF0000; background-color:transparent}
You can refer to Style Sheet Tutorial for a complete understanding on CSS.
Otherwise you can use <body> tag to set link colors. Here is the syntax.
<body alink="#FF0000" link="#900B09" vlink="#900B09">
.......
</body>

Create Download Links:

You can create text link to make your PDF, or DOC or ZIP files downloadable. This is very simple, you just need to give complete URL of the downloadable file as follows:
<a href="http://www.example.com/file.pdf">Download File</a>
This will produce following link and will be used to download a file.
Download File
You can not make an image download able until you follow the following procedure.

How To Raise a "File Download" Dialog Box ?

Sometime it is desired that you want to give option where a use will click a link and it will pop up a "File Download" box to the user in stead of displaying actual content. This is very easy and will be achived through HTTP header.
This HTTP header will be different from the header mentioned in previous section.
For example,if you want make a FileName file downloadable from a given link then its syntax will be as follows.
#!/usr/bin/perl

# HTTP Header
print "Content-Type:application/octet-stream; name=\"FileName\"\r\n";
print "Content-Disposition: attachment; filename=\"FileName\"\r\n\n";

# Actual File Content will go hear.
open( FILE, "<FileName" );
while(read(FILE, $buffer, 100) )
{
   print("$buffer");
}

19 Comments

  1. A QuickBooks Payroll Support Phone Number service is a webpage you are able to activate by firmly taking the subscription allow it to be easy when it comes to top features of Payroll in your QuickBooks desktop software.

    ReplyDelete
  2. Common issues thatQuickBooks Support Number receives: Very often client faces some typically common issues like he/she isn’t happy to open QuickBooks package, it really is playing terribly slow, struggling to install and re-install, a challenge in printing checks or client reports. We plan to give you the immediate support by our well- masterly technicians. A group of QuickBooks tech Support dedicated professionals is invariably accessible to suit your needs so as to arranged all of your problems in an attempt that you’ll be able to do your projects while not hampering the productivity.

    ReplyDelete
  3. If this doesn’t help you, go ahead and connect to us at QuickBooks Payroll Support Phone Number. Most of us works 24*7 and serve its customers with excellent service each time they contact us. Regardless of what issue is and however complex it really is, we assure you that we offers you optimal solution as soon as possible.

    ReplyDelete
  4. You can further read the contact information on how to Contact QuickBooks Phone Number. QuickBooks technical support team are active for only 5 days (Mon-Fri) in a week. The QuickBooks Technical Support Phone Number is accessible these days from 6 AM to 6 PM.

    ReplyDelete
  5. You might have trapped into a problem with Intuit product and payroll services? You're going to be ready to understand the best approach to get your hands on the customer support team. QuickBooks Payroll Support USA welcome you 24*7 to access the various support services of Intuit products asking for help.

    ReplyDelete
  6. Our QuickBooks 247 Support Phone Number team is enthusiastic and makes best usage of its experience. They just do not let go any issue even if it is fairly complex.

    ReplyDelete
  7. QuickBooks software package is developed this kind of a fashion that it will give you the most effective account management mention of this era. However, you can face the issue along with your QuickBooks Support Phone Number software and begin trying to find the solution. You must not worries, if you're facing trouble utilizing your software you're going to be just a call away to your solution. Reach us at QuickBooks Support Phone Number at and experience our efficient tech support team of many your software related issues. If you're aa QuickBooks enterprise user, you'll be able to reach us out immediately at our QuickBooks Support contact number . QuickBooks technical help is present at our QuickBooks tech support number dial this and gets your solution from our technical experts.

    ReplyDelete

  8. Retail: the absolute most time-consuming business type is retail. It entails large amount of some time hard work. With QuickBooks Enterprise Technical Support it becomes super easy to handle the entire hassle for the variety of business.

    ReplyDelete
  9. Our 3rd party independent AccountWizy Quickbooks support phone number and our experts are 24/7 active to give you QuickBooks Tech Support Phone Number service because of its products.

    ReplyDelete
  10. It is rather possible you can face trouble while installing QuickBooks Pro software since this essentially the most universal problem. You don't have to go any where if you encounter any difficulty in QuickBooks Installation, just call us at QuickBooks Support Phone Number and experience matchless support services.

    ReplyDelete
  11. What business will you be having? Could it be raw material business? Can you cope with retail trade? Craftsmen also deal with your collection of revenue. Sometimes you do not forecast the QuickBooks Tech Support Number precise budget. We now have experienced people to offer the figure.

    ReplyDelete
  12. Our dedicated team is sure with you. These are typically surely working at any hour to assist and make suggestions if you run into any QuickBooks error/s. Our Intuit QuickBooks Support Number team surely have in-depth knowledge regarding the issues and complications of QuickBooks.

    ReplyDelete
  13. If you are in search of an entire solution for Business Bookkeeping, therefore QuickBooks give you an entire and ideal solution. You have to dial the QuickBooks Support Phone Number and receive a productive alternative for all of your bookkeeping requirements.

    ReplyDelete
  14. We have the best and the most convenient answer to enhance your productivity by solving every issue you face with the software. Give us a call at QuickBooks Help Number to avail the greatest customer service services designed for you.

    ReplyDelete

  15. QuickBooks has almost changed it is of accounting. Nowadays accounting has exploded to become everyone’s cup of tea and that’s only become possible because because of the birth of QuickBooks accounting software. We have the best and the most convenient answer to enhance your productivity by solving every issue you face with the software. Give us a call at Support For QuickBooks to avail the greatest customer service services designed for you.

    ReplyDelete
  16. Payroll and its own attributes demand lots of care and attention. These attributes of every business or organization always need to be run in safe hands. QuickBooks Payroll is software that fulfils the requirement for accuracy, correctness, etc. in Payroll calculation. Our team at QuickBooks Technical Support Number makes sure to combat the errors that hinder the performance with this software.

    ReplyDelete
  17. Best QuickBooks Support Phone Number Help To Simplify Accounting Dial QuickBooks provides QuickBooks Customer Service in the same way as intuit. We assist you to manage, run and maintain your accounting application. In present time QuickBooks made largest number of achievements with lots of contribution for financial access.

    ReplyDelete
  18. We provide complete assistance to help you learn the fundamentals of one's QB accounting software. From setting up a payroll to handling all payroll related activities, our expert technicians can offer you hands-on training to help you use QuickBooks Payroll Support Number with full confidence.

    ReplyDelete
Previous Post Next Post