LESSON 03 –
HTML BASICS II
VIEWING
SOURCE CODE
When we are looking at the content of an HTML
document along with all the tags, it is called viewing the source code. One can do this for any website! In internet explorer, you simply go under
View and click on Source.
ABSOLUTE
REFERENCE VS RELATIVE REFERENCE
A
reference is simply a file name and location.
When you place an image on an html document, you must give a reference
to it. The same goes when you want to
make a link to another page. There are
two ways to make references.
An
absolute reference is giving the file’s complete location and name. Examples are:
H:\comtech\webdesign\lesson2\images\fun.jpg
http://www.lockerby.net/media/header.jpg
A
relative reference is giving the file’s location with respect to the
location of the html document in which this file is referenced.
EXAMPLES OF RELATIVE REFERENCING
a) If the file is in the same folder as
the html document, you simply put the file name.
<img src=″fun.jpg″>
<a
href=″page2.html″>link text</a>
b) A common approach in webdesign is to place all images in a subfolder called
images. To reference the images called
fun.jpg, we need to add the subfolder name to the reference.
<img src=″images/fun.jpg″>
c) Sometimes, instead of referencing a
file in a subfolder, you need to reference a file in a parent folder. To go up one level, we need to use the dot dot (..) reference. To make a link to the file index.html that is
in the parent folder, we use:
<a href=″../index.html″>link text</a>
RELATIVE BETTER THAN ABSOLUTE
A
relative reference is usually better than an absolute reference because it will
continue to work even if the files are relocated to a new location (as long as
the folder structure is still together).