HTML Links



In HTML, links are created using the <a> (anchor) element.  Then is the  introductory syntax for creating a link :

<a href="URL">Link Text</a>

  • href : This attribute specifies the URL (Uniform Resource Locator) to which the link points. It can be    an absolute URL (e.g., http://www.example.com) or a relative URL (e.g., page.html).
  • Link Text This is the  textbook that  druggies will see as the clickable link. 


Here are some examples:

1. Absolute URL:  

<a href="http://www.example.com">Visit Example.com</a>

2. Relative URL: 

<a href="page.html">Go to Page</a>

3. Linking to an Email Address: 

<a href="mailto:info@example.com">Email Us</a>

4. Linking to a Phone Number:  

<a href="tel:+1234567890">Call Us</a>

5. Linking to a File (e.g., PDF):  

 
<a href="documents/document.pdf">Download PDF</a> 

6. Opening a Link in a New Tab/Window:   

<a href="http://www.example.com" target="_blank">Visit Example.com</a>

The target="_blank" attribute opens the link in a new tab or window.

Remember to replace the placeholder values (URLs, email addresses, etc.) with your actual content. Additionally, providing descriptive and meaningful link text is important for accessibility and search engine optimization.

Post a Comment

Previous Post Next Post

Popular Items

HTML Table Sizes :

HTML Fevicons

CSS Syntax :