The HTML anchor tag can be used to create hyperlink to other web page as well as files, location, or any URL. The “href” attribute is the most important attribute of the HTML a tag. and it links to destination page or URL.
SYNTAX: <a href=”URL” [attribute list]>link Text</a>
the URL specifies the name and location of a file we want to link or the name and location of webpage we want to link. In our example we will link to another file.
By default the specified or linked page opens on same page but we can open it in another page by specifying an optional attribute target and giving a _blank value to it. But in our example we will open it on same page.
Lets write the below code after img tag and before h1 tag of about.html
<a href="myskills.html">My Skills</a>
Now open about.html in a web browser you will see an anchor tag below header image. But click on this may give error because we have not created our myskills.html page. Let us create another text file. Rename it as myskills.html and write the below codes in it.
<title>About Me-Subrat Dash</title>
<img src="ttrc-logo.jpg" width="100%" height="auto" border="2px"/>
<a href="about.html">About Me</a>
We placed a link to my skills page on about.html and a link to about page in myskills.html . So click on the link My skills on about.html page we can open myskills.html page and clicking on the about me link we can open about.html page in the same webpage. Practically do it to enjoy the course and increase the self confidence with in you.
Check your progress
Q) Which attribute of the link tag specifies the URL location of the anchor tag ?
Q) Which attribute of the link tag provides us the facility to open the link in a new page.