| | | |
|---|
Comments, Questions, Suggestions, or Opinions Tutorials Lesson:
Exercises For every lesson:
My accounts:
|
HTML Hyperlinks (Links)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:
HTML Link SyntaxThe HTML code for a link is simple. It looks like this:
<a href="url">Link text</a>
The href attribute specifies the destination of a link. Example
<a href="http://www.w3schools.com/">Visit W3Schools</a>
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. HTML Links - The target AttributeThe 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: HTML Links - The id AttributeThe 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. ExampleAn anchor with an id inside an HTML document:
<a id="tips">Useful Tips Section</a>
Create a link to the "Useful Tips Section" inside the same document:
<a href="#tips">Visit the Useful Tips Section</a>
Or, create a link to the "Useful Tips Section" from another page:
<a href="http://www.w3schools.com/html_links.htm#tips"> Visit the Useful Tips Section</a> Basic Notes - Useful TipsNote: 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/". HTML Link Tags
Click here to take the exercises of this lesson -->
|