#1
|
|||
|
|||
HTML Links
A link is the "address" to a document (or a resource) on the web.
Try it Yourself - Examples HTML links This example demonstrates how to create links in an HTML document. Open a link in a new browser window This example demonstrates how to link to another page by opening a new window, so that the visitor does not have to leave your Web site. (You can find more examples at the bottom of this page) Hyperlinks, Anchors, and Links In web terms, a hyperlink is a reference (an address) to a resource on the web. Hyperlinks can point to any resource on the web: an HTML page, an image, a sound file, a movie, etc. An anchor is a term used to define a hyperlink destination inside a document. The HTML anchor element , is used to define both hyperlinks and anchors. We will use the term HTML link when the element points to a resource, and the term HTML anchor when the elements defines an address inside a document.. An HTML Link Link syntax: Link text The start tag contains attributes about the link. The element content (Link text) defines the part to be displayed. Note: The element content doesn't have to be text. You can link from an image or any other HTML element. The href Attribute The href attribute defines the link "address". This element defines a link to W3Schools: Visit W3Schools! The code above will display like this in a browser: Visit W3Schools! The target Attribute The target attribute defines where the linked document will be opened. The code below will open the document in a new browser window: Example target="_blank">Visit W3Schools! The name Attribute When the name attribute is used, the element defines a named anchor inside a HTML document. Named anchor are not displayed in any special way. They are invisible to the reader. Named anchor syntax: Any content The link syntax to a named anchor: Any content The # in the href attribute defines a link to a named anchor. Example: A named anchor inside an HTML document: Useful Tips Section A link to the Useful Tips Section from the same document: Jump to the Useful Tips Section A link to the Useful Tips Section from another document: Jump to the Useful Tips Section Basic Notes - Useful Tips Always add a trailing slash to subfolder references. If you link like this: href="http://www.w3schools.com/html", you will generate two HTTP requests to the server, because the server will add a slash to the address and create a new request like this: href="http://www.w3schools.com/html/" Named anchors are often used to create "table of contents" at the beginning of a large document. Each chapter within the document is given a named anchor, and links to each of these anchors are put at the top of the document. If a browser cannot find a named anchor that has been specified, it goes to the top of the document. No error occurs. More Examples An image as a link This example demonstrates how to use an image as a link. Link to a location on the same page This example demonstrates how to use a link to jump to another part of a document. Break out of a frame This example demonstrates how to break out of a frame, if your site is locked in a frame. Create a mailto link This example demonstrates how to link to a mail message (will only work if you have mail installed). Create a mailto link 2 This example demonstrates a more complicated mailto link. Similar Threads:
|
#2
|
|||
|
|||
#3
|
|||
|
|||
Link to a location on the same page
This example demonstrates how to use a link to jump to another part of a document. Chapter 1This chapter explains ba bla bla Chapter 2This chapter explains ba bla bla Chapter 3This chapter explains ba bla bla Chapter 4This chapter explains ba bla bla Chapter 5This chapter explains ba bla bla Chapter 6This chapter explains ba bla bla Chapter 7This chapter explains ba bla bla Chapter 8This chapter explains ba bla bla Chapter 9This chapter explains ba bla bla Chapter 10This chapter explains ba bla bla Chapter 11This chapter explains ba bla bla Chapter 12This chapter explains ba bla bla Chapter 13This chapter explains ba bla bla Chapter 14This chapter explains ba bla bla Chapter 15This chapter explains ba bla bla Chapter 16This chapter explains ba bla bla Chapter 17This chapter explains ba bla bla See also Chapter 4. Chapter 1 This chapter explains ba bla bla Chapter 2 This chapter explains ba bla bla Chapter 3 This chapter explains ba bla bla Chapter 4 This chapter explains ba bla bla Chapter 5 This chapter explains ba bla bla Chapter 6 This chapter explains ba bla bla Chapter 7 This chapter explains ba bla bla Chapter 8 This chapter explains ba bla bla Chapter 9 This chapter explains ba bla bla Chapter 10 This chapter explains ba bla bla Chapter 11 This chapter explains ba bla bla Chapter 12 This chapter explains ba bla bla Chapter 13 This chapter explains ba bla bla Chapter 14 This chapter explains ba bla bla Chapter 15 This chapter explains ba bla bla Chapter 16 This chapter explains ba bla bla Chapter 17 This chapter explains ba bla bla |
#4
|
|||
|
|||
Break out of a frame
This example demonstrates how to break out of a frame, if your site is locked in a frame. Locked in a frame? target="_top">Click here! Locked in a frame? Click here! |
#5
|
|||
|
|||
Create a mailto link
This example demonstrates how to link to a mail message (will only work if you have mail installed).
---------------- This is a mail link: Send Mail Note: Spaces between words should be replaced by %20 to ensure that the browser will display your text properly. |