Links are found in nearly all Web pages. Links allow users to click their way from page to page.
How to create links in an HTML document.
(You can find more examples at the bottom of this page)
The HTML <a> tag defines a hyperlink.
A hyperlink (or link) is a word, group of words, or image that you can click on to jump to another document.
When you move the cursor over a link in a Web page, the arrow will turn into a little hand.
The most important attribute of the <a> element is the href attribute, which indicates the link’s destination.
By default, links will appear as follows in all browsers:
The HTML code for a link is simple. It looks like this:
The href attribute specifies the destination of a link.
which will display like this: Visit W3Schools
Clicking on this hyperlink will send the user to W3Schools' homepage.
Tip: The "Link text" doesn't have to be text. It can be an image or any other HTML element.
The target attribute specifies where to open the linked document.
The example below will open the linked document in a new browser window or a new tab:
The id attribute can be used to create a bookmark inside an HTML document.
Tip: Bookmarks are not displayed in any special way. They are invisible to the reader.
An anchor with an id inside an HTML document:
Create a link to the "Useful Tips Section" inside the same document:
Or, create a link to the "Useful Tips Section" from another page:
Note: Always add a trailing slash to subfolder references. If you link like this: href="http://www.w3schools.com/html", you will generate two requests to the server, the server will first add a slash to the address, and then create a new request like this: href="http://www.w3schools.com/html/".
An image as a link
How to use an image as a link.
Link to a location on the
How to link to a bookmark.
Break out of a frame
How to break out of a frame (if your site is locked in a frame).
Create a mailto link
How to link to a mail message (will only work if you have mail installed).
Create a mailto link 2
Another mailto link.
|<a>||Defines a hyperlink|
The perfect solution for professionals who need to balance work, family, and career building.
More than 10 000 certificates already issued!
The HTML Certificate documents your knowledge of HTML.
The HTML5 Certificate documents your knowledge of advanced HTML5.
The CSS Certificate documents your knowledge of advanced CSS.
The jQuery Certificate documents your knowledge of jQuery.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
Your message has been sent to W3Schools.