ADDING AN IMAGE
GENERAL INFORMATION
You can add an image to your
webpage by using the following tag:
<img
src="filename.ext">
The image file needs to be in the
same folder as your html document.
LOCATION OF USE
You can place the tag anywhere
between the <body> and </body> tags.
COMMON ERRORS
- The
image file must be in the same folder as your html document (or you must
specify the path).
- The
filename must include the extension.
- Double
quotes must appear before and after the filename.
- The
image type should be jpg or gif.
Other image types are not completely supported by all
browsers.
- BMP
images often seem to work but can lead to problems. Do not use them!
- Do not
rename an image from *.bmp to *.jpg.
You must convert the image.
A simple way to do this is to open the image in Paint and then save
it as a JPG.
OPTIONAL ATTRIBUTES
- alt
This will specify the text that will show if the image cannot be
displayed. The text can also be
seen when the mouse is left on the image for a second.
- width
This will set the image’s width.
(It is almost always best to resize images using a program such as
Paint.NET or Photoshop.)
- height
This will set the image’s height. (It is almost always best to resize
images using a program such as Paint.NET or Photoshop.)
EXAMPLES
Click here to see an
example of an image in a webpage. Use
View Source to see the code.
Click here to see the same image
with all attributes in use. Use View
Source to see the code.