<a>
. The href
attribute is used to specify the URL or web address of the page or resource that the link is pointing to.Here is an example of a basic hyperlink in HTML:
<a href="https://www.example.com">Visit Example.com</a>
This will create a link that says "Visit Example.com" and when clicked, will take the user to the specified URL "https://www.example.com"
You can also create links to specific locations within a page by using the id
attribute on the target element and then using the href
attribute with a "#" followed by the id of the target element, like this:
<a href="#section1">Go to Section 1</a> ... <h2 id="section1">Section 1</h2>
This will create a link that says "Go to Section 1" and when clicked, will take the user to the element with id "section1" within the same page.
You can also use the target
attribute to specify how the link should be opened, for example, in a new tab or window.
In summary, hyperlinks in HTML are created using the anchor tag <a>
, with the href
attribute specifying the URL or web address of the page or resource that the link is pointing to. You can also point to specific location within the same page using the id
attribute or open the link in a new tab or window using the target
attribute.
Social Plugin