Writing your own webpages (Continued)

Pictures

There's 2 ways to use pictures in html files, either as decorations ( which can also be used as links) or as backgrounds. To add a picture onto your page as a decoration you use the tag <img> and add the word src= (The address and name of the file you want it to display).

<img src=pictures/picture.jpg>

A browser will use the file it is told to have a a background as a tile to cover the whole window. Remember this when creating the background picture. We tell the browser which file to use in the body tag, like this:

<body background=picture.jpg>

By the way, when you put a website together you need to organise all your files so you know where they are. I put all my pictures in a sub-directory called pictures. So links to pictures must have that address in them:

<body background=/pictures/picture.jpg>

Also remember that, on the web, we use forward slashes instead of the back slashes you use on your hard drive.

The background picture on this page is a mere 2 pixels wide and over 1000 deep, which is deep enough to cover any screen. The browser has automatically tiled it from left to right. If the picture is wider than it is deep, the browser will then tile it from the top of the page, to the bottom. To reload the page using a picture as a background that is only 2 pixels deep but over 1000 wide click here

Next page!