In another group there has been some discussion about linking files for download and I notice that a lot of the participants don't seem to know how to make a basic web link using HTML which is necessary to link a document or file on a web page.

If you are posting a link in facebook you just include the URL (web address) like this:

https//stephenbhenry.com/html-coding/creating-links/

and facebook automatically makes it into a link. It musst start with http:// in order for this to happen. If you are reading this on facebook, click that link for the rest of this article...

If your website is WordPress based then you can make a link using the chain link button in the function menu of the page/post visual editor or the link item in the text editor.

But, sometimes you just have to code the link yourself. In these cases a little basic HTML coding ability goes a long way. It's easy to do and easy to remember if you actually learn what you are doing. Take a few minutes and continue reading this post. It's not too geeky and, when you are done, you will be armed with a basic tool for creating links almost anywhere you go on the 'net. You CAN do it!

First of all you need to know something about HTML. Hyper-Text Markup Language (HTML) is not some complicated programming language. It is a basic set of tags used to mark sections and functions in web documents (usually website pages).

HTML tags are mostly used in pairs, an opening tag and a closting tag, to mark up sections of the document. For example, paragraph tags, <p> and </p>, are used to mark, or indicate, a single paragraph. As you can see, the tags use pointy brackets (or the less-than and greater-than math signs) to designate them. The opening tag contains the tag name first, in this case "p" for paragraph. The closing tag has a slash followed by the tag name.

Sometimes the opening tag will contain additional information that applies to the markup content. This extra stuff is never repeated in the closing tag.

In order to make an HTML link, that's all you need to know about HTML in general. The next bit you need to know is which HTML tag to use for the link. You might think it would be a LINK tag with an L but that's not the case. For some reason, known only to the geeks that created this stuff, a link in HTML is called an anchor and, therefore, it uses an "a" as the tag name, like this: <a> and </a>.

In order to make a link you wrap the text (or image) you want to use for the link in anchor tags and include the "hyper-reference" (the address of the thing you are linking to) in the opening tag, like this:

<a href="http://mydomain.com/folder/document.pdf">Download PDF</a>

Notice that "href" (short for hyper-reference) is followed by the equal sign and then the URL (or address) in quotation marks. This is included inside the pointy brackets of the opening anchor tag. The words Download PDF are enclosed by the opening and closting anchor tags and will, therefore, become the link text.

That's all there is to making a link, however there is something else you need to know. Different web browsers, like Internet Explorer, Chrome, Safari, Firefox, etc., will respond in different ways to different file types. For some they will begin the download process so you can save the linked file to your computer and for some they will attempt to display, play, or render, the file.

For example, .zip (archive) files will automatically download in most every browser, where as .mp3 (sound) files will attempt to play in most browsers. Also, .pdf (document) files will attempt open in most browsers. If you want a music or document file to download you may have to do one of these things:

  1. Create a .zip archive file containing your sound or document file.
  2. Use complicated programming (javascript or PHP) code to force the download.
  3. Provide instructions for forcing the download in most browsers.

In most cases, the last one is probably best. You will need to tell your viewers that to download their file they need to right-click (control-click on a Mac) on the link, and select either save as, save file as, or save target as (depending on their browser) to initiate the file download. This works in all browsers with a properly constructed link.