1. Computing

Discuss in my forum

Adding Images to Web Pages

Images and Graphics on Web Pages

By

To add an image, icon, or graphic to your web page, you need to use the IMG tag. You place the IMG tag in your HTML where you want the graphic to display:

<img src="graphic.gif">

Images are easy to add to your web pages. The IMG tag has only two required attributes: SRC and ALT. The SRC attribute tells the browser which image to display, and ALT tells the browser what to display if it can't show the image.

The IMG tag also has two other attributes that you should use when you put a graphic on your web page:

The WIDTH and HEIGHT attributes tell the browser the size of the image. The browser then knows exactly how much space in the layout to allocate, and it can move on to the next element on the page while the image downloads. You should use the actual dimensions of your image, rather than having the browser resize it for you.

How to Find the Height and Width of Your Images

If you load the image in Firefox, the width and height are displayed in the title: filename.gif (GIF image, width x height pixels). Internet Explorer displays the height and width that are written in the HTML not the actual image size if you right click on the page and choose properties.

The IMG Tag

<img src="URL to the image" width="width in pixels" height="height in pixels" alt="alternative description of the image">

Current Articles

  1. About.com
  2. Computing
  3. Web Design / HTML
  4. Web Design
  5. Graphics
  6. Adding Images to Web Pages

©2014 About.com. All rights reserved.