Free HTML Lesson - How To Include Images in Web Pages Part 1
Free HTML Lesson - How To Include Images in Web Pages Part 1
Free HTML Lesson - How To Include Images in Web Pages Part 1
Including images is very simple. You employ the <IMG> tag. The required attribute of this
tag is SRC, which takes the value of the image file's URL.
<IMG SRC="ash.jpg">
The SRC attribute determines the source of the image file and takes a URL as value. I have
used a relative URL which shows that ash.jpg is located in the same directory as this file.
Three kinds of images files .gif, .jpg and .png are used on the Internet. A general rule of
thumb is to use .jpgs for photographs and .gifs for images containing large blocks of single
colors.
The <IMG> tag has many attributes
WIDTH: used for specifying the width of the image
HEIGHT: specifies height
BORDER: displays a border around the image
ALT: helps to insert a descriptive text for users using text based browsers or for
visitors with visual disabilities.
HSPACE: inserts space at the left and right of the image
VSPACE: inserts space at the top and bottom of the image
NAME: gives a name to the image; necessary for client-side scripting
using JavaScript
LOWSRC: provides a method through which a low quality alternate of the image is
displayed first before the final one starts to load.
ALIGN: aligns other HTML elements such as text around the image.