HTML <a> href Attribute
Example
<a href="https://www.google.com">Visit Google</a>
Meaning
Hyperlink of the page used to navigate.
Notes: You can use href="#" to link to the top of the current page!
Standard Syntax
<a href="URL">
Advertisement
Attribute Values
| Value | Description |
|---|---|
| URL | Value can be
|
More Examples
How to use an image as a hyperlink
Example
<a href="https://www.google.com">
<img alt="Google" src="img/image.jpeg" width="200" height="200">
</a>
How to open a hyperlink in a new browser window.
Example
<a href="https://www.google.com" target="_blank">Visit google.com!</a>
How to hyperlink to an email address
Example
<a href="mailto:username@email.com">Send email</a>
How to hyperlink to on the same page
Example
<a href="#chapter2">Go to Chapter 2</a>
How to hyperlink to a JavaScript
Example
<a href="javascript:alert('Hello World!');">Click me to Execute.</a>