Cover Image for HTML Anchor
198 views

HTML Anchor

HTML anchor is a tag used to create hyperlinks to other web pages, files, or specific parts of a webpage. The <a> tag is used to define an anchor in HTML.

It can create hyperlink to other web page as well as files, location, or any URL. The “href” attribute is the most important attribute of the HTML a tag. and which links to destination page or URL.

<a href="http://www.google.com">link</a>

In this example, we’ve used an <a> tag to create a hyperlink to the Google homepage. The “href” attribute specifies the URL of the page we want to link to. We’ve also included the text “link” between the opening and closing <a> tags to display the hyperlink as clickable text.

Anchor tags can also be used to create links to other parts of the same webpage. To do this, we need to specify the ID of the element we want to link to in the “href” attribute. For example:

<p id="link">This is a paragraph of text.</p>
<a href="#link">Link to paragraph</a>

In this example, we’ve given the second paragraph an ID of “link” using the “id” attribute. We’ve then created a hyperlink to this paragraph by specifying “#link” as the value of the “href” attribute.

Overall, HTML anchor tags are an essential part of HTML formatting, as they allow us to create hyperlinks to other web pages, files, or specific parts of a webpage, making it easier for users to navigate and access information on a website.

YOU MAY ALSO LIKE...

The Tech Thunder

The Tech Thunder

The Tech Thunder


COMMENTS