Home >> FAQs/Tutorials >> XHTML Tutorials and Tips >> Index

XHTML 1.0 Tutorials - Understanding Hyper Links and URLs

By: FYICenter.com

Part:   1   2  3  4  5  6 

A collection of 16 FAQs/tutorials tips on XHTML hyper links and URLs. Clear answers are provided with tutorial exercises on anchor tags/elements, URL structures, different formats of URLs, hyper links to image, music, PDF and ZIP files, opening documents in new windows. Topics included in this collection are:

  1. What Are Hyper Links?
  2. What Is an Anchor (A) Tag/Element?
  3. How To Define a Hyper Link?
  4. How To Define a Bookmark?
  5. What Is a URL?
  6. What Is the Structure of a URL?
  7. What Happens If Protocol or Port Number Is Missing in a URL?
  8. What Happens If a URL Starts with Path or File name?
  9. What Is a Relative Path Name?
  10. What Happens If File Name is Missing in a URL?
  11. How To Build Hyper Link Indexes within the Same Document?
  12. What Happens If a Hyper Link Points to an Image?
  13. What Happens If a Hyper Link Points to a Music File?
  14. What Happens If a Hyper Link Points to a PDF File?
  15. What Happens If a Hyper Link Points to a ZIP File?
  16. How To Create A Link to Open a Document in a New Window?

Please note that all notes and tutorials are based on XHTML 1.0 specification.

What Are Hyper Links?

A hyper link is a special text in an XHTML document defined with a hidden link to another resource on the Internet. While viewing the XHTML document, you can click the hyper link, the browser will follow the hidden link to fetch the linked resource to you.

Hyper links in XHTML documents are specified with "a" elements. Different types of resources can be linked behind hyper links, like XHTML documents, images, video clips, and executable programs.

What Is an Anchor (A) Tag/Element?

An "a" element is an inline element that you can use to specify a hyper link in your XHTML document. An "a" element can also be used to define a bookmark in your XHTML document. Here are basic rules about "a" elements:

  • "a" elements are inline elements.
  • "a" elements can not be used at the block level.
  • An "a" element defines a hyper link, if the "href" attribute is used.
  • An "a" element defines a bookmark, if the "name" attribute is used.

How To Define a Hyper Link?

If you want to define a hyper link in your XHTML document, you need to use an "a" element with the "href" attribute. Here are basic rules about defining a hyper link with "a" element:

  • An "a" element with the "href" attribute defines a hyper link.
  • The "href" attribute is used to specify a URL representing the linked resource.
  • The content of the "a" element should not be empty.
  • The content of the "a" element will be highlighted by most browsers to allow viewers to click the hyper link to retrieve the linked resource.

Here is a good tutorial example of hyper link elements:

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
 <head>
  <title>Hyper Link Elements</title>
 </head>
 <body>
  <p>"The weak can never forgive. 
  Forgiveness is the attribute of the strong." 
  <a href="http://en.wikiquote.org/wiki/Mahatma_Gandhi"
   >Click here</a> to find out the author 
  of this quote.</p>
 </body>
</html>

If you save the above document as hyper_link.html, and view it with Internet Explorer, you will see that a hyper link is showing up in the paragraph. The hyper link text is "Click here" displayed in different color with an underline as shown below:
            Hyper Links

(Continued on next part...)

Part:   1   2  3  4  5  6 


Selected Developer Jobs:

More...