Saturday, 5 November 2011

HTML Hyperlinks

The World Wide Web as we know it is founded on hyperlinks. A hyperlink is a location in a resource that links to another location in that resource or links to another resource. When you click on the link in your browser, your browser knows where to go through the uniform resource locator, or URL. A URL (Uniform Resource Locators) is the address that identifies a resource. Usually that resource is another Web page, although it might be something else, such as an image or video.

Use the anchor tag <a> to reference other locations. Those locations can be other locations in the same document or different documents. The marking up anchors task illustrates the use of the anchor tag for linking to other locations in the same document. This task illustrates the use of the anchor tag for navigating to other documents. You use the anchor tag’s href attribute to specify to other documents. This task illustrates using href to point to external sites using absolute URLs. The next task illustrates internal links using relative URLs.

Example : <a href="http://www.youtube.com"> YouTube – Broadcast Yourself</a>

Relative URLs

The link in main.html to sub.html simply references the file, as they are in the same folder. The link from main.html to sub two.html includes a . to indicate the current directory, a forward slash, the subdirectory’s name and the file. The link from sub two.html back to main.html includes a .. which navigates back to the next level up.

Example: <a href="../main.html">Main.</a>

No comments:

Post a Comment