HTML Links 📌


An HTML Link helps us to add a direct link to files or website present at same address or the other.

There are 3 types of Linking:
1. Internal Linking
2. External Linking
3. Linking to sections of a document


Example of HTML Internal Linking

Internal Linking means linking to file in same directory.

            
<!DOCTYPE html>
  <html lang="en">
    <head>
    </head>
  <body>
      <a href="Internal_Link_html.html">This is a Internal Link</a>
  </body>
</html>
            
        
This is a Internal Link


Example of HTML External Linking

External Linking means linking to a External file or website not in same directory.


            
<!DOCTYPE html>
  <html lang="en">
    <head>
    </head>
  <body>
      <a href="https://www.google.com/">This is a External Link to Google.com</a>
  </body>
</html>
            
        
This is a External Link to Google.com


Example of Linking to sections

Linking to sections means linking to some section in same html file.

        
<!DOCTYPE html>
  <html lang="en">
    <head>
    </head>
  <body>
    <h2 id="Section_to_go">Example of HTML Internal Linking</h2>
    <p>Internal Linking means linking to file in same directory.</p>
    <img src="Image 1.png" alt="" style="height: 200px; width: 400px;">
    <br>
    <a href="Internal_Link_html.html">This is a Internal Link</a>
    <br>
    <a href="https://www.google.com/">This is a External Link to Google.com</a>
    <a href="#Section_to_go">This is a Link to section of Internal Link.</a>
  </body>
</html>
              
        
This is a Link to section of Internal Link.

On Clicking on above link, you will be directed to Section of Internal Link.