Basic Usage
<img src="path/to/image.jpg" alt="Image description" />
Attributes
Attribute | Description |
---|
src | The path to the image file. |
alt | The text to display if the image fails to load. |
width | The width of the image in pixels. |
height | The height of the image in pixels. |
title | The text to display when the user hovers over the image. |
Example
<img src="path/to/image.jpg" alt="Image description" width="200" height="200" title="Image title" />
Notes
- The
alt
attribute is required for accessibility. It is used by screen readers to describe the image to visually impaired users.
- The
width
and height
attributes are optional. If you do not specify them, the image will be displayed at its original size.
- The
title
attribute is optional. It is used to provide additional information about the image when the user hovers over it.