Simple hypertext links - Web Designing

The anchor (<a>) tag is used to identify a string of text or an image that serves as a hypertext link to another document. Linking to a string of text looks like this:

I am <A HREF="link.html">linking</A> to you!

To make an image a link, enclose the image tag within the anchor tags as follows:

<A HREF="link.html"><IMG SRC="pixie.gif"></A>

Most graphical browsers display linked text underlined and in blue by default, but this behavior can be altered. Linked graphics appear with a blue outline (unless you turn the outline off in the <img> tag by setting the border attribute to zero).

The URL is the pathname of the document you want to link to. URLs can be absolute or relative.

Absolute URLs
An absolute URL is made up of the following components: a protocol identifier, a host name (the name of the server machine), and the path to the specific filename. When you are linking to documents on other servers, you need to use an absolute URL. The following is an example of a link with an absolute URL.

Here the protocol is identified as http (HyperText Transfer Protocol, the standard protocol of the Web)

Relative URLs
A relative URL provides a pointer to another document relative to the location of the current document. The syntax is based on pathname structures in the Unix operating system. When you are pointing to another document within your own site (on the same server), it is common to use relative URLs.

By default, a relative URL is based on the current document. You can change that by placing the <base> element in the document header (<head>) to state explicitly the base URL for all relative pathnames in the document. The <base> tag can only appear in the <head> of the document, and it should appear before any other element with an external reference. The browser uses the specified base URL (not the current document's URL) to resolve relative URLs.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

Web Designing Topics