Using Links in HTML
The web wouldn’t be anything if it wasn’t for hyperlinks. Hyperlinks, or links, are what make the web, well, the web. They are the connecting source of all the trillions and trillions of pages that saves us from typing in the path to every single page possible. In this tutorial, you will learn how to add a hyperlink in your project and control its actions.
If you have not already done so, open Visual Studio and begin a new web project. If you do not wish to use Visual Studio, a text editor such as notepad will do.
The first thing we will need is the simple markup of a website. It will be relatively empty at first, however we will leave that to your imagination. The following is the basic markup to have an HTML document:
Notice that we have an opening and closing “a” tag with a hyperlink reference set to empty quotes. Within those quotes goes the link to your file or the external directory or website of choice.
Now say you wanted to open the link in your own specified way, you can place the target attribute to _New, _Blank or _Same. The _New value will give it a new page to load on, _Blank will give it a blank page and _Same will open the link on the same page as the one you are currently on. Here we display the _Blank value for the Target attribute.
<a href="http://htmlatoms.com" target="_blank">HTML Atoms</a>
A Few Last Words…
Hyperlinks are not limited to being words, they can be images as well. We discuss using images as hyperlinks in a future tutorial. Thank you for being a valued reader and join us next time for additional HTML tutorials.