Many of the times we need to link a page to another while creating a website. Linking pages require html tags to be inserted within the first page. This page can be in the same directory or any directory above or downwords. Here are some html tags referring another page.
If the page is in the same folder on your website, you can use a simple "relative link" to point to it:
<
a href="http://www.blogger.com/otherpage.html">
This is a link to otherpage.html, in the same folder
If the page you are linking to is in a sub-folder within the folder containing the page you are writing, you can still use a relative link:
<
a href="http://www.blogger.com/subfoldername/otherpage.html">
This is a link to otherpage.html, in a sub-folder called subfoldername
If the page is not in the same folder, but is on the same website, you can use a path that begins with / to refer to it. If the page is in a folder called foldername inside the main website folder, you can write:
<
a href="http://www.blogger.com/foldername/otherpage.html">
This is a link to otherpage.html, in the
folder called foldername
The leading / means "start at the top and go down."
There is one more type of relative link you may wish to use. If the page you are now writing is in folder A, and the page you wish to link to is in the parent folder that contains folder A, you can write:
<
a href="http://www.blogger.com/otherpage.html">
This is a link to otherpage.html, in the
parent folder of this folder
That is, "../" in a relative URL means "go up one level in the folder hierarchy."
Using relative links is recommended, where possible, because it allows you to move pages from site to site or folder to folder as long as they maintain the same relative relationship to one another.
If the page is on another website, you must use an "absolute" link. You can make these easily by browsing to the page you wish to link to, then selecting the URL in the "address bar" at the top of the browser window and selecting "copy" from your web browser's edit menu. Here is an example:
<
a href="http://www.boutell.com/newfaq/">
For more information, follow this link to
Boutell.Com's WWW FAQ.
Linking to a file that is not a web page is accomplished in the same way; no special technique is necessary. For example:
<
a href="http://www.blogger.com/myfile.doc">
This is a link to myfile.doc, a Word document
You can link to images in this way, if you wish. If your real goal is to make the image part of your page, you will want to use the
<
img src="http://www.blogger.com/post-edit.g?blogID=4809694467087109581&postID=4053476429622113806" /> element instead. Note that you should never embed an image on someone else's website into your page without their express permission. In most cases, the src attribute of an img src="http://www.blogger.com/post-edit.g?blogID=4809694467087109581&postID=4053476429622113806" /> element will be a file on your own site:
<
p>
This page has an image in it. myimage.jpg is a file
in the same folder as this web page. <
p>
<
img src="http://www.blogger.com/myimage.jpg" />
Notice that the src attribute of the img element works exactly like the href attribute of the a element.
This is copied from ww.boutell.com/newfaq/creating/links.html
No comments:
Post a Comment