Labs ICT
โญ Pro Login

Anchor Tags

So you want to add links to your page. Let me show you how. The <a> tag โ€” short for "anchor" โ€” is what makes the web a web. Without it, you would just have a bunch of isolated pages that nobody could navigate between.

Every link needs two things: something to click on (the text or image inside the tag) and somewhere to go (the href attribute). Think of href as the destination address.

Your First Link

Wrap the text you want to be clickable in an <a> tag and set href to the URL you want to visit.


<a href="https://www.example.com">Visit Example Website</a>
    
Try it Yourself โ†’

Linking Between Your Own Pages

When linking to another page on your own site, you can use a relative path โ€” just the filename or the path to it. No need to type the full URL.


<a href="about.html">About Us</a>
<a href="contact.html">Contact</a>
    

If the page is inside a folder, include the folder name: <a href="blog/post1.html">Read Post</a>.

Links Inside Text

Links do not have to sit on their own line. You can drop them right into a paragraph.


<p>Check out my <a href="portfolio.html">portfolio</a> 
to see my latest work.</p>
    

Only the linked text will be clickable โ€” the rest of the paragraph stays normal.

Email Links

You can also create links that open the user's email program. Use mailto: in the href.


<a href="mailto:hello@example.com">Send me an email</a>
    

When clicked, this will open the default email client with the address already filled in.

๐Ÿงช Quick Quiz

Which attribute specifies the URL in an anchor tag?