To create a link in HTML page, you use the HTML link tag <a>..... </a>. The <a> tag is also called an anchor tag because it also can be used to create anchors for links. The most common use of the link tag, however, is to create links to other pages. The <a> tag requires attributes in order to be useful. You've seen optional attributes like style that can be used with basically any tag. The <a> tag uses attributes to define the link.
So rather than the opening <a> tag having just the tag name inside brackets. The additional attributes describe the link itself. The attribute you'll probably use most often is the href attribute, which is short for hypertext reference. You use the href attribute to specify the name or URL to which this link point.
<link rel = "stylesheet" href = "css/style.css">
- Use to move seamlessly from one page to another.
- How two ends called anchors
👉Links - Target Attribute
- Tell where to open link document
- Four defined targets:
- blank: New window or tab
- parent: Parent window
- self: Same window or tab
- top: Full browser window
<a href = "url" target = "_top"> Link 1 </a>
<a href = "url" target = "_blank"> Link 2 </a>
<a href = "url" target = "_parent"> Link 3 </a>
👉Links - Bookmark Anchors
- To jump to specify section
- To step process:
- First add id attribute on target element
- Use id value preceded by (#) in herf attribute of <a>
The rel Attribute
One additional attribute that's supported by the <a> tag is the rel attribute, which is used to describe the relationship between the linking document and the document that the user is linking to. There's a set of specific values that should be used with this attribute. The most well known is the nofollow attribute, which which indicates that search engines should not factor that link unto their ranking of the document that is linked. nofollow is intended as a measure to fight search engine spam. like example,
HTTP
HTTP stands for Hypertext Transfer Protocol. HTTP URLs are by far the most common type of URLs because they point to other documents on the Web. HTTP is the protocol that the World Wide Web servers use to communicate with web browsers. Itself not reliable but use TCP to achieve reliability. HTTP is the combination of FTP and SMTP.
Example
NOTES.....
To point to an anchor in a link, use the same form of the link that you would when linking to the whole page, with the filename or URL of the page in the href attribute. After the name of the page, however, include a hash sign (#) and the ID of the element exactly as it appears in the id attribute of that element. Before browsers supported linking to elements directly using their IDs, you had to use the name attribute of the <a> tag to create anchors on the page which you could link.