Example
Create a link to W3Schools.com:
Visit W3Schools.com!
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The
Try it Yourself »
Example
How to open a link in a new browser window:
Visit W3Schools.com!
Try it Yourself »
Example
How to link to an email address:
Send email
Try it Yourself »
Example
How to link to a phone number:
+47 333 78 901
Try it Yourself »
Example
How to link to another section on the same page:
Go to Section 2
Try it Yourself »
Example
How to link to a JavaScript:
Execute JavaScript
Try it Yourself »
Related Pages
HTML tutorial: HTML Links
HTML DOM reference: Anchor Object
CSS Tutorial: Styling Links
Default CSS Settings
Most browsers will display the Visit W3Schools
Try it Yourself »
More "Try it Yourself" examples below.
Definition and Usage
The href
attribute specifies the URL of the page the link goes to.
If the href
attribute is not present, the
or
href="#"
to link to the top of the current page!
Browser Support
href | Yes | Yes | Yes | Yes | Yes |
Syntax
Attribute Values
URL | The URL of the link. Possible values:
|
More Examples
Example
How to use an image as a link:
Try it Yourself »
Example
How to link to an email address:
Send email
Try it Yourself »
Example
How to link to a phone number:
+47 333 78 901
Try it Yourself »
Example
How to link to another section on the same page:
Go to Section 2
Try it Yourself »
Example
How to link to a JavaScript:
Execute JavaScript
Try it Yourself »
❮ HTML tag