Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

WDS9 - More about HTML Links

In the last article we learned about:
  • Quotations
  • Comments in Html.
Now in this post, we are going to see HTML links in detail.
We know that we can use links in HTML to navigate from one page to another. When we hover over element containing a link, it generally changes to blue and mouse changes to hand icon in the browser. We all have seen examples of links in previous posts where we used following things:
  • Enclosing text to be used as link in and tags
  • Giving href Attribute in tag and setting its value to the desired link
In all the examples we used the text links to other webpages that are sites like google.com or say, facebook.com, but it is interesting to know that you can enclose other HTML elements such as images inside link tags to use images as the link to other pages.
To do this, first we will create a image in HTML using tag and then we will enclose it within and tags with href attribute.

Also, we can create bookmarks in the Document so that users can directly go to the specified part in the large document much like you see in Wikipedia. So let's see how to create it.
First, let's create a paragraph and give it attribute id and set it's value to say para5. Now create another element with text like Link to Paragraph 5 and enclose it within and tags while giving it href attribute with value #para5. In short, we will give attribute same as id to paragraph but including # symbol to tell HTML that text following it indicates id. You will clearly see it's effect only when your document is large so that your page will scroll down to that particular element.

That is more than sufficient knowledge regarding links, but as we are learning I am also adding one more thing here, target attribute in links.
We can add the target attribute to link element to control where to open the linked page or document.

            Value of target                                                       Use
  1. _blank                         Open the document/ link in new window or tab
  2. _self                            Open the document/ link in same window or tab
  3. _top                             Opens the document in the full body of the window
  4. _parent                        Opens the document in parent window

That's all for this article.In the next part, we will learn more about images and will also start tables in HTML. Comment on how you think this article is, what improvements should I do and for any doubts. Share with your friends and keep coding.




This post first appeared on The Coding Express, please read the originial post: here

Share the post

WDS9 - More about HTML Links

×

Subscribe to The Coding Express

Get updates delivered right to your inbox!

Thank you for your subscription

×