A hyperlink is a piece of text or an image on a web page that, when clicked, takes the user to another web page or a different location on the same page. Hyperlinks are created using the `<a>` (anchor) element in HTML.
To create a hyperlink, you can use the `href` attribute to specify the destination of the link. For example:
<a href="http://example.com">Visit our website</a>
This will create a hyperlink that says "Visit our website", and when clicked, it will take the user to the specified URL (in this case, "http://example.com").
You can also use the `<a>` element to create a link to a specific location on the same page. To do this, you can use the `name` attribute to define the location, and then use the href attribute with a `"#"` symbol followed by the name of the location to create the link. For example:
<a name="section1">Section 1</a>
...
<a href="#section1">Jump to Section 1</a>
This will create a link that says "Jump to Section 1", and when clicked, it will scroll the page down to the location with the name "section1".
You can also use the `target` attribute to specify how the linked document should be opened. For example:
<a href="http://example.com" target="_blank">Visit our website</a>
This will create a link that opens the specified URL in a new browser window or tab.
For more information about the `<a>` element and how to use it to create hyperlinks, you can refer to the HTML specification.
Comments (0)