1
Use the anchor element to link from page to page Configure absolute, relative, and hyperlinks Configure relative hyperlinks to web pages in folders within a website Configure a hyperlink to a named fragment internal to a web page
The anchor element Inline-level element Specifies a hyperlink reference (href) to a file Text between the and is displayed on the web page. Contact Us href Attribute Indicates the file name or URL Web page document, photo, pdf, etc. 3
Absolute link › Link to other websites Yahoo Relative link › Link to pages on your own site › Relative to the current page Home 4
Shampoo Home Dog Bathing 5 Relative links from the collars page in the products folder
The target attribute on the anchor element opens a link in a new browser window or new browser tab. Yahoo! 6
Automatically launch the default mail program configured for the browser If no browser default is configured, a message is displayed 7
A link to a part of a web page Also called named fragments, fragment ids Two components: 1. The element that identifies the named fragment of a Web page. This requires the id attribute. ….. 2. The anchor tag that links to the named fragment of a Web page. This uses the href attribute. Back to Top 8 Note the use of the # in the anchor tag!
9
This part of chapter 2 provided an overview of using the anchor element to code hyperlinks.