HTML LINKS
HTML Links are very necessary for all web pages. All web sites have links. HTML Links are hyperlinks.
Links help users jump from their current web page location to another.
To make HTML Links we just need to use the <a> element with the href attribute that specifies a URL to a page.
HTML Link Structure
- Start tag. <a>
- href Attribute. e.g. href="index.html"
- Element Content. A text e.g. Home Page. It can also be an image and other HTML elements.
- End tag </a>
Internal Linking Example:
Linking inside our directory.
<a href="file-in-the-same-folder.html"> Linking inside</a>
Note! Some external links may not open from the Try It Yourself Editor but you can save the file to your local storage and test it in a real browser.
External Linking
Linking outside our directory.
<a href="https://www.wikipedia.org">external linking </a>
Opening Link in New Tab
- We an easily open a link in a new tab.
- To do it we need to use the target attribute with the value blank.
- This would be helpful if you do not want your visitors to leave your web site.
<a href="https://www.wikipedia.org" target="_blank"> open link in new tab </a>