![]() |
WEB DESIGN SKILLSModule Study Guide
|
Web pages with just text on them are all very well, but before long you will
want to add some pictures to brighten things up!
This is quite easy to do, but first you need to do a little housekeeping:
Any simple pages you have already created should be held in a folder somewhere, probably in your user area. We will refer to this folder as your root folder. To put pictures on to your pages, you must save the image files somewhere. You can put them into your root folder along with the web pages, but this can get confusing as your site grows. Common practice in the industry is to make a special folder inside your root folder called "images" (or something similar) into which you save all the image files you need.
So, to add an image to your page, first obtain a suitable image from somewhere. The most obvious place to get one is to download one from the internet, but you could use one you've made yourself in a drawing or painting program, or one from a digital camera.
NB: You can only use downloaded images here because this is an educational exercise carried out under the control of an educational institution. If you are creating a commercial site you CANNOT just use downloaded images from the internet without obtaining permission.
The image must be in an appropriate format, which for the web generally means either GIF or JPEG.
We can summarise the difference between these formats as follows:
GIF: uses a lossless compression technique, but only employs a limited palette (256 colours). Principally used for images which only have a restricted set of colours, such as clipart or logos. May have transparent backgrounds. Animated GIFs can also be produced.
JPEG (usual suffix .jpg): compression ratios can be high, but the technique used is lossy i.e. the compressed image is not as good as the original. Uses 24-bit colour, so is mainly used for photos. The compression ratio can be altered by the originator, to give high quality-low compression or low quality-high compression (or somewhere in between).
Images downloaded from the internet will already be in a suitable format, although you might need to change the size or crop them to fit your page. Other images, however, may need converting into an appropriate format as above. Using Photoshop this is relatively easy to do:
Let's assume you have saved an image called "picture05.jpg" in a folder called "images". To add this to your web page, insert the following code in the page:
<img src="images/picture05.jpg">
You might want to add some additional attributes to this line, such as:
<img src="images/picture05.jpg" alt="A tree in my
garden" hspace="10" vspace="5" align="left">
alt A text string which appears if the browser cannot display
the image for any reason. This attribute is a requirement if you want the page
to validate properly (see validation later
in the module).
hspace, vspace Defines the horizontal and vertical
space left around the image on the page, in pixels
align The image may be aligned left or right. Text placed after
the image will appear on the right if the image is left-aligned, and vice versa
(see below). If you want the image to appear on a line by itself, omit this
attribute. Notice that 'center' is not an option here.
After positioning the cursor at the place you want the image to appear, look at the top of the screen. You should see a bar which looks like this:
(If the bar looks different to this, and the selected tab is not 'Common', click on 'Common' to select it.)
The 'tree' icon here represents 'insert image', so if you click on this you can select the image you want to use.
With the image selected, the 'Properties' box looks like this:

You can add the 'Alt' text here. You can also insert V Space and H Space values and adjust the alignment.
By
default, only one line of text is allowed alongside an image. To allow text
to flow properly around an image, as you see in newspapers and magazines, set
the alignment for the image as 'left' (image on the left, text on the right)
or 'right' (image on the right, text on the left).
vspace, hspace and align attributes
and observe the effects. Add text to the page to see what effect the align attribute
has on it.