asp.net.ph

Skip Navigation LinksHome > Abakada: Back to Basics > Authoring Your Web Pages > Web Authoring Basics

Web Authoring Basics

Next: Understanding HTML


Fragment identifiers

Some URIs refer to a location within a resource, such as within an HTML document. This kind of URI ends with the pound sign (#), followed by a fragment identifier, which refers to a named location on the file.

http://hostname/path/filename#identifier

For instance, to point to a part named "section1" in a document named "main.html", the URI would be:

http://www.somewhere.com/main.html#section1

Relative or Partial URIs

If a resource is located on the same machine as the current document, we could write the resource address as a partial or relative URI, as in:

main.html#section1

With relative URIs, we may omit the protocol and host name information. The partial URI may contain relative path components, such as the double dot sign (..), which means one level up in the directory tree, and may contain fragment identifiers.

Relative URIs are resolved to full URIs by specifying a base URI, or base address at the start of an HTML document. If you do not specify a base URI, the base path defaults to the directory of the site’s main document.

For instance, if your Web site’s welcome page is located at:

http://www.somewhere.com/index.html

all partial or relative URIs would expand to the base path "http://www.somewhere.com/", plus the relative URI.

Conclusion

In HTML, URIs are used to:

  • Link to another document or resource
  • Link to an external style sheet or script
  • Include an image, object, or applets in a page
  • Create a frame document
  • Submit a form
  • Create an image map
  • Cite an external reference
  • Refer to metadata conventions describing a document

While there may be parts of a URI where case does not matter, e.g. machine names, authors should always consider that URIs are case-sensitive, to be on the safe side.

For further reading on URIs, see the W3C’s URIs for the World Wide Web.


More ...
Back to top


© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note