Welcome back for this second blog about the basis “know how” of HTML, today we will take a closer look at anchor (Or Hyperlinks), you can find the details on mozilla.
In the first blog we’ve look at the main structure of a web page, now it’s time to link our pages with the HTML anchor tag.
The “a” tag is very useful since they allow us to navigate throughout the web. Let’s start by taking a look an example:
<a href="www.example.com">My Site!</a>
Most of the time, the text within the tag will be perceive as à blue underline link. In the first portion of the “a” tag, you’ll notice that we started to add an attribute. Attribute will farther detail what a particular tag can and cannot do. The further we will move into the HTML course, the more tags we’ll discover.
In the above example, we’ve used the attribute “href” that stands for “HyperText Reference” (and not for “Hip-Hop Research and Education Fund” or “Histamine Release Enhancing Factor”!). This attribute will allow us to tell the browser which pages it will need to open. In the above example, when the user press on the text “My Site!” he’ll be redirected to the web site www.example.com.
When writing a hypertext link, you don’t have to write the complete address, you can write a relative path. For example, if in the same directory you have two file and one of them is called contact.html, in the second page you could write the following link:
<a href="contact.html">Leave us a comment</a>
In my next blog, we will start using image with the “img” tag.
Meanwhile, here is the video tutorial of the blog: