Anchor Tags



Anchor Tags

Anchor tags are use to set addresses or links in particular element for go on one page to other page. When we click on about us link, contact us link in any web site than this link take us on that page inside this anchor tags are use. These are very useful and we can use these with a single word, images, buttons and with complete line. Let see how can we use anchor tags

Input

<a href="http://google.com">Click Me For Go On Google</a>
<button><a href="http://google.com"></a></button>

Output

Click Me For Go On Google


We can use anchor tags by various ways and anchor tags are contains some attributes also. By various ways are means is anchor tags are user friendly we can set anchor tags with any kind of element like a single word, in navigation panel, inside buttons, with images and with complete line, As we see in above example. Anchor tags contained two major attributes, first is href and second is target. Href is stands for set link reference. We can set address inside this where we want to by particular element. Target attribute is use for set that we want to go on link by same browser tabs or by new another tab.

You notice in some website when we click on any link than this link open the page in new tab or sometimes when we click on any link than this link open in own tab these functionality is set by target attribute. If we don't use target attribute with anchor tag than link open in own window by default but if we don't want to close that page and want to open link in new tab than we use target="_blank" function with anchor tag let try yourself how this works in below example.

Input

<a href="http://google.com">Click Me For Go On Google</a><button>
<a href="http://google.com" target="_blank">Google</a></button>

Output

Click Me For Go On Google

Use Anchor tags in Navigation

We also use anchor tags into navigation menu in website locally for go one page to other page link like about and contact page. This is also very easy step just use anchor navigation care fully. Suppose there are are a main folder name website inside this home.html file exists. Website folder also contains two sub folders name about and contact. In about folder we create about.html file and inside contact folder we create contact.html file. Now how can we connect all these page together where all the files in different folders. How this is possible let see.

Navigation Layout

Website (folder)
|	|	|__	about (folder)       
|	|			|___about.html (file)       
|	|_________contact (folder)        		     
|				|__-contact.html (file) 	
|___ home.html (file)

Setting up Navigation

home.html
|	|_<a href="about/about.html">About</a>
|_____<a href="contact/contact.html">Contact</a>
---------------------------------------------------------------------------------------
about.html
|   |_<a href="../index.html">Home</a>
|___<a href="../contact/contact.html">Contact</a>
---------------------------------------------------------------------------------------
contact.html
|	|_< a href="../index.html">Home</a>
|_____< a href="../about/about.html">About</a>

Wconcert Images. . / Sign is use for come back in main folder from sub-folder. We have here one main folder name website, inside this we contains 2 folders name about and contact. There is also a file exits name home.html. Contact folder contains contact.html file. About folder contains about.html. So how can i go on about and contact page, we mention is above boxes. When we are on contact.html or about.html page and want to go on home page back than a problem occur usually for beginners in navigation. For sought out this problem we use ../ sign before navigate because now we are in sub-folder and we have to use ../ sign before navigate to go on main folder's file.


Wconcert India © 2015   ·   All Rights Reserved

Free Web Hosting