The Arusha Times

On The Web

ISSN 0856-9135

No. 00287

September 13-19, 2003

Infotech

 

Building your home on the World Wide Web, Part 3

By Duncan Drury

If you have been following this tutorial for the past two weeks you should now have a rather plain, but functional, web site. You have learnt to create a page, put text on it, and link it to other pages. This week, let’s jazz things up a bit by adding some pictures and colour.

Background knowledge

Adding pictures to a web page works in a very similar way to adding links. To add a picture use the <img> (image) tag with the src (source) attribute - <img src="picture.gif"/>. "picture.gif" is the filename of the image you want to include on your page. The src attribute works in the same way as the href attribute in the <a> tag. Both tell the computer where to find a file. I have made the examples so far simple by putting all the files in the same folder – you only need to refer to the name of the file. What if the image you want to show is in another directory, or even on another web server? There are two ways of getting at other files stored in a different directory. To illustrate these imagine your web server contains the files and folders as in figure 1. You are working on myPage.html and want to get at other files from that page.

C Relative to the page in question – to put picture2.gif on the page you would refer to it with the folder name and then the file name, separated by a / - <img src="images/picture2.gif"/>. If you wanted to put picture3.gif on your page you have to go up into the web folder first and then into the arusha folder. To do this you begin your reference with "../" ../ will always take you into the folder that contains the one you are currently in. So to add picture3.gif you use the following tag <img src="../arusha/picture3.gif"/>. Similarly, to link to anotherPage.html you use the following <a> tag <a href="../Arusha/anotherPage.html">. You can use several ../ in a row to move back through several directories.

C Absolute referencing will only work for files uploaded to a web server. Absolute referencing finds a file using its location relative to the root folder on the web server. The root folder can be accessed using "/". To add picture3.gif to your page using absolute referencing use the following tag <img src="/web/arusha/picture3.gif"/>. This might be faster than typing lots of "../"s.

To show a picture on another web site you need to know its full address – e.g. http://www.dumasafari.com/photos/mt-kilimanjaro.jpg – put the address in the src attribute, remembering the "http://"!

Note that the <img> tag does not have a closing </img> tag – instead you put a / before the final >. A few other tags work in this way, for example <br/> to insert a line break and <hr/> to add a horizontal line across the page.

Getting stylish

Now you have some pictures, what about some colours for the text and background? To add style to your page you add the style attribute to your tags. Add a style attribute to a <h1> tag on your page - <h1 style="color:red;">. This makes the text turn red. Styles work by saying what you want to change, followed by a colon (:), followed by the appropriate value, in this case the name of a colour. Since this was invented in America, you have to use the American spelling "color". Style instructions must finish with a semi-colon (;). This allows you to add further style instructions - <h1 style="color:red;background-color:black;"> changes the text to red and the background of the text to black. You can add as many instructions as you like. Some other instructions you might find useful are font-size, for controlling the size of text and font-family which changes the font. E.g. <h1 style="font-family:courier;font-size:18pt;color:red;background-color:black;">Some stylish text</h1>.

You can add a style attribute to any tag within the body of the page, and also to the <body> tag itself – setting style="background-color:black;" in the body tag will make the whole page have a black background.

Have a look at www.geocities.com/mynyamachoma to see how I have used styles and images to make the site look more interesting than it did last week. Remember to view the source and see how I did it.

Taking it further

Now you have created some pages upload them to your geocities site using the file manager tool.

Hopefully over the last three weeks I have demystified the creation of web sites. It really is something anyone with access to a computer and the web can do. You can improve your pages further by learning more HTML. The resources below will help with this. Good luck. Send your sites and questions to duncandrury@yahoo.com

Interesting web sites

www.webmonkey.com – has some very good tutorials and teaching tools, and a list of colours you can use. Look in the Authoring – HTML Basics section and at the HTML Cheatsheet.

www.w3c.org – keepers of the full specifications for HTML and other things to do with web pages.

www.blooberry.com/indexdot/ - handy information on all tags and styles available.

Features

Back Home Up Next

Home ] Local News ] Features ] UN Tribunal ] Courts & Crime ] Street Talk ] Off Topic ] Dark side ] Play ] Meditation ] Verses ] Interview ] Mailbag ] Sports ] Archives ] Contact Us ] Search Arusha Times ]

Last modified: September 11, 2003.
Copyright © 2001, 2002, 2003 Arusha Times.  E-mail:
arushatimes@habari.co.tz

Webmaster:   WDJMallya