In this post lets see how do we add hyperlinks and images to our HTML documents.
You can add hyperlinks simply by using the <a> tag. Consider the example given below:
<head><title> Links </title></head>
<a> Hey take me to Codefap </a>
In the above example, we added “Hey take me to Codefap” text between the a tags. However the text is appearing as a normal text. If we want to convert it into a link. We need to add a HREF attribute to the a tag.
Now attributes might be new concept for you guys. But its very simple. Consider attributes as combination of keyword and values which give additional information about the tag.
So now lets add HREF attribute. I will just show the part of the code to which we are going to make the changes. Everything else remains as it is. Only the a tag changes. So here it is :
<a href="http://www.codefap.com"> Hey take me to Codefap </a>
So you can see, using HREF attribute we provided additional information to the a tag. Now it converted our simple text to a hyperlink. And for your information, HREF means Hypertext reference. It just provides the reference address, so that when we click on the hyperlink we are directed towards the reference address.
Want a Video Tutorial for this Post? Check this out :