How to Make a Link

Html Links

© Christine Decourlande

Nov 6, 2008
Hyperlink, Jarkko Laine
Making a link in your text can enhance the online reading experience, when done correctly. Explore the linking options that can make your work more informative.

Hypertext links can give readers additional information. But long urls can wrap or scroll across the screen, looking messy and poorly formatted. Long urls also force the reader to scroll to the right to continue reading.

Html

The most basic hypertext link encloses the navigation url within a simple html anchor tag with an href attribute. This allows the reader to see the title of the link, the hypertext, instead of having to read a long url. Embedding a hyperlink in your writing allows the reader to see only the title, Cloud Computing, as in the following example.

<a href="http://office-software.suite101.com/article.cfm/cloud_computing_in_your_business">Cloud Computing</a>

When the reader clicks on Cloud Computing, the new url will open in the current browser tab or window if that is the default.

Adding the target attribute to the above code tells a browser to open the url in a new tab or window. Instructing the browser to open the url in a new tab or window keeps the reader on your page. The code would be modified as,

<a href="http://office-software.suite101.com/article.cfm/cloud_computing_in_your_business" target="_blank">Cloud Computing</a>

Another useful attribute is top. Top allows the link to open outside of the current frame. This is especially helpful when creating a link inside a forum or bulletin board system (which allows html) that maintains a header advertisement when opening links. The code looks like this:

<a href="http://office-software.suite101.com/article.cfm/cloud_computing_in_your_business" target="_top">Cloud Computing</a>

Think of the a in a href as anchor and href as hypertext reference. URL is the uniform resource locator. If the link looks odd on the page, or does not launch correctly, check the brackets and quotes. These are containers.

Email Links

Creating a mailto link causes the default mail program to launch when a reader clicks on it. You can create a mail link in much the same way as a hypertext link. The simplest form of a mailto link:

<a href="mailto:cdecourlande@some-pop-server.com">Send Mail</a>

Adding a question mark allows you to insert the subject of the email as well.

<a href="mailto:cdecourlande@some-pop-server.com?subject=html%20question">Ask Html Question</a>

BBCode

BBCode is often used on bulletin boards, or forums, in lieu of html. It is also known as phpBB. Creating links in BBCode is similar to creating links in html. But it is not the same.

The code for a basic link in BBCode would look like this example.

[url=http://geekthoughts.net/wp/]Geek Thoughts[/url]

BBCode Mail Links

BBCode automatically recognizes email addresses as links in the same way that it recognizes all plain urls that begin http:// To specify an email address, format it as follows:

[email]cdecourlande@some-pop-server.com[/email]

Additional learning resources can be found at W3 Schools and phpBB.


The copyright of the article How to Make a Link in Computer Programming Tutorials is owned by Christine Decourlande. Permission to republish How to Make a Link in print or online must be granted by the author in writing.


Hyperlink, Jarkko Laine
       


Post this Article to facebook Add this Article to del.icio.us! Digg this Article furl this Article Add this Article to Reddit Add this Article to Technorati Add this Article to Newsvine Add this Article to Windows Live Add this Article to Yahoo Add this Article to StumbleUpon Add this Article to BlinkLists Add this Article to Spurl Add this Article to Google Add this Article to Ask Add this Article to Squidoo