HTML
HTML introduction
HTML basics
HTML colors
HTML backgrounds
HTML text
HTML font
HTML text formatting
HTML entities
Display tags
HTML links
Email links
Types of links
HTML images
HTML image maps
HTML tables
HTML frames
HTML forms
Fieldset/legend tags
HTML stylesheets
Div/span tags
HTML layout
HTML marquees
HTML multimedia
HTML meta tags
HTML document types
HTML base tag
HTML scripts
URL formatting
Encoding and decoding
HTML summary

Programming

Programming intro
Java

Markup

First webpage guide
XHTML

Style & Layout

CSS

Browser scripting

Javascript
VBScript
AJAX

Server scripting

PHP
ASP

Making money online

Make money online

Relative and absolute linking

There are two different ways to create a link, so then how should links be formatted?

This lesson focuses on:

Relative linking

Relative linking refers to linking to files that are on the same domain. With relative linking, you do not have to link to the entire path for a file.

Example:

The file html-basics.php is located at http://www.landofcode.com/html/html-basics.php and we want to link to it from a file named html-frames.php located in the same directory. Instead of creating a link to that full path, we can create a relative link to it. The relative link would look like this since the two files are in the same directory:

<a href="html-basics.php">HTML basics</a>

A relative link involves linking to a file on the same domain relative to the directory that the file linking to it is in.

Absolute linking

Absolute linking refers to linking to files using the entire path for the file.

Example:

<a href="http://www.landofcode.com/javascript/javascript-variables.php">Javascript variables</a>

Absolute linking is usually done when linking to files on another domain different from the file in which the link is located in.

Practice

Online code editor
Practical examples
Practical exercises
Step-by-step tutorials

Reference

Terms glossary
Reference material

Rate this site

Rate this site
Visitor comments