HTML Link are two types one is link that is used in head section and the other one is anchor link. Link tag is used to link external style sheets or css files. And anchor link is to add links to pages within websites or to external websites. The
<a> is an anchor tag and it defines a hyperlink, which is used to link from one page to another. The most important attribute of the
<a> element is the href attribute, which indicates the link’s destination.
HTML Link Tag
The rel attribute in <link> tag defines the relationship between a document and an external resource. This <link> tag is most used to link to style sheets.
Syntax of an HTML Link tag
<head> <link rel="stylesheet" type="text/css" href="style.css"> </head>
HTML Link Tag – Anchor <a> tag
Syntax of an anchor <a> tag
Hyperlink text will be added in between opening and closing anchor tag. And destination url will be added to anchor link using href attribute.
<a href="http://www.codingcyber.com">Link text here</a>
1) HTML Link: New Window
If you want to open this link in new window, then add target attribute and the value is _blank
<a href="http://www.codingcyber.com" target="_blank">Link text here</a>
2) HTML Link: Email Link
If you want to add an email link, then use mailto: in href attribute.
<a href="mailto:[email protected][dot]com">Contact Us</a>
3) HTML Link: Named Anchors
Named anchor links are used to move through different sections of long single html document. Here is the sample code for named anchors
<p>Link Targets<a name="named_anchor_link"></p>
For calling this named anchor in <a> tag, add html page link then hash symbol then named anchor.
<a href="your-page.html#named_anchor_link" target="_blank">Link here</a>