In this article we will talk about an important tag in HTML called the anchor tag. In the article you will find:
- What is the anchor tag,
- How and why it is used,
- Simple examples,
- And what is its role in SEO (Search Engine Optimization).
This article is for those who are new to web designing.
![]() |
| HTML Anchor Tag |
What is an anchor tag?
The anchor tag or <a> tag is an HTML element that represents a link. It is used to access another web page, website, or file. When you click on a text or image and you reach another place, then understand that the anchor tag has been used there.
Why and how is the anchor tag used?
The most common use of the anchor tag is to create a hyperlink. With the help of this tag, you can:
- provide a link to another web page,
- direct the reader to another post on your blog,
- create a link to download a file.
Its basic syntax is:
<!DOCTYPE html>
<html>
<head>
<title>Anchor Tag Example</title>
</head>
<body>
<a href="URL">Link Text</a>
</body>
</html>
Here:
- href means "hypertext reference", in which you write the address of the link.
- "Link text" is the text that the user clicks to open the link.
2 examples of anchor tag
Link to another website:
<!DOCTYPE html>
<html>
<head>
<title>Anchor Tag Example</title>
</head>
<body>
<a href="https://www.google.com">Visit Google</a>
</body>
</html>
Link to blog post:
<!DOCTYPE html>
<html>
<head>
<title>Anchor Tag Example</title>
</head>
<body>
<a href="https://www.rayscoding.com/search/label/php-crud">PHP Crud</a>
</body>
</html>
How does it help in SEO?
Anchor tag is very important for SEO. It tells the search engine which keywords are important in your page. When you add a relevant link with good anchor text, Google understands what your content is about. This helps in improving the ranking of your blog.
If you do internal linking (give a link to another post of your own blog), then it is even more beneficial for SEO.
Conclusion
The anchor tag is a small HTML element, but its use can bring huge benefits to your blog. This easily takes your readers to another page, and also improves the SEO of your blog. If you want, you can also create a link by putting the image inside the anchor tag.
