Zebra0.com

html5Adding Pictures

Adding Pictures

Adding Pictures

The image tag, img, gives the source, src, for the picture. Sources can be either absolute or relative.

Here is a pictures that is in the same directory, or folder, as the page.
Picture of thee world

The tag simply says <img src="world.png" width="125" height="125" alt="Picture of the world"/> No path is given.

Here is the same picture, using the absolute path for the zebra0.com directory:

Picture of the world, surrounded by stick figures of children

The tag says <img src="/HTML/pictures/world.png" width="125" height="125" alt="Picture of the world, surrounded by stick figures of children"/>

Here is the same picture again, this time using the URL where the picture can be found:

Picture of the world, surrounded by stick figures of children

This time the tag is <img src="http://www.hello-world.com/images/world.png" alt="Picture of the world, surrounded by stick figures of children">

Size: height and width

The height and width are optional. If it is missing, the browser will render the picture in its full size according to information in the image file.

Alt

Notice the alt portion of the img tag. The alt tag is very important to people with vision problems. A screen reader will tell the visitor what the image is about if they are not able to see the image.

Don't forget: You can always see the source code by right clicking on a webpage and selecting view source.

Next: Lists