Home

Table of
Contents


Editors

Tags

Text
Formatting


Entities

Links

Frames

Tables

Lists

Forms

Images

Backgrounds

 



The Image Tag and the src Attribute


In HTML, images are defined with the <img> tag.
The <img> tag is empty, which means that it contains attributes only and it has no closing tag.
To display an image on a page, you need to use the src attribute. Src stands for "source". The value of the src attribute is the URL of the image you want to display on your page.

The Alt Attribute


The alt attribute is used to define an "alternate text" for an image. The value of the alt attribute is an author-defined text
The "alt" attribute tells the reader what he or she is missing on a page if the browser can't load images. The browser will then display the alternate text instead of the image. It is a good practice to include the "alt" attribute for each image on a page, to improve the display and usefulness of your document for people who have text-only browsers.

Image Tags

Tags Description
<img> Defines an Image
<map> Defines an Image Map
<area> Defines an Area inside an Image Map

 

Background Image
This example demonstrates how to add a background image to an HTML page.

Aligning Images
This example demonstrates how to align an image within the text.