Most of the web pages contain links that go to other web pages or web resources. To code a link in HTML use the <a> element (or anchor element). Because this element is an inline element, you usually code it within a block element like <p> element. In this HTML tutorial, you'll learn how to code links.
HTML Link Attribute of <a> Element
|href||Specifies a relative or absolute URL for a link.|
Notes on HTML Link Element
- The content of a link should be a text that clearly indicates where the link is going.
- The <a> element is an inline element that creates a link that loads another web page. The href attribute of this element identifies the page to be loaded.
- The text content of a link is underlined by default to indicate that it's clickable.
- If a link hasn't been visited, it will display in blue. If it has been visited, it will display in purple. You can change these values using CSS.
- If the mouse hovers over a link, the cursor is changed to a hand with the finger pointed as shown above in the featured image of this article.
<html lang="en"> <body> <h1>HTML Links</h1> <h2>A link to a web page in the same folder</h2> <p>Click to view our <a href="items.html">Item List</a></p> <h2>A link to a web page in a subfolder of the parent folder.</h2> <p>We give the following <a href="../company/servies.html">Services</a></p> <h2>A link to a web page based on the root folder</h2> <p>View our <a href="orders/cart.html">Shopping Cart</a></p> <h2>A link to a web page at another web site.</h2> <p>Learn more <a href="https://foxinfotech.in/">Fox Infotech</a></p> </body> </html>
As shown in the featured image.
- HTML Special Block Elements
- How to Include 2 Columns Under One Column Header in HTML Table? (rowspan using c)