The Image Tag

The image tag can be as simple as

<img src="filename.gif">


But it is preferable to add some important properties to your image tag:

<img src="filename.gif" width="300" height="200" border="0" alt="Welcome to My Web Site">


The height and width are in pixels and you can get them easily by using photoshop or by dropping your image in a browser (most browsers).

For XHTML, the image tag must have a closing slash (/) because the image tag is a single tag (has no closing tag) like <br>. That would look like:

<img src="filename.gif" width="300" height="200" border="0" alt="Welcome to My Web Site" />


Remember to name your image files correctly. Always make sure you have the right path from the page to wherever the image is located, or your image will not show up.

dpi

Most computer monitors show 96 or 72 pixels/inch, so an image for the web only has to be 72 pixels/inch in size. If you are used to print, that is a big difference from 300 dpi.

syllabus