Web Design / HTML

  1. Home
  2. Computing & Technology
  3. Web Design / HTML

Adding Images to Web Pages

Images and Graphics on Web Pages

By Jennifer Kyrnin, About.com

Images add interest and excitement to your Web pages, and they are fairly easy to add. 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.

However, there are two other attributes that it is strongly recommended you include:

  • width
  • height
The width and height attributes tell the browser how big the image is. This allows the Web page to render more quickly, as the browser can allocate space for the image and then move on to the rest of the page while the image downloads.

Hint on Finding the Width and Height:

If you load the image in Netscape, the width and height are displayed in the title, "GIF image width x height pixels - Netscape". Internet Explorer displays the height and width that are specified by 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" />

Previous Articles

Explore Web Design / HTML

About.com Special Features

Build Your Own Website

Step-by-step advice on how to do everything from choosing a Web host to promoting your content. More >

Connect Your Home Computers

Easy ways to connect two computers for networking purposes. More >

Web Design / HTML

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. Web Design
  5. Graphics
  6. Adding Images to Web Pages

©2009 About.com, a part of The New York Times Company.

All rights reserved.