<img src= alt= height= width= longdesc= />
The img element defines an image. It is an inline element.
The main attributes are:
- src
-
- Specifies a valid url for the image resource to be displayed
- It can be a relative or an absolute URL
- This attribute is required for every <img> element
- alt
-
- Gives a replacement for the image, not a description of the image
- Displayed when the image is unavailable (could be a user option, eg mobile, blind, slow connection etc))
- A screen reader normally provides the alt text to the user
-
Must be provided, used by both browsers and screen readers
- width, height
-
- Defines width and height in pixels
-
Should be provided
- longdesc
-
- the URL of a file that provides additional information about the image
- Provide sufficient information for, say, a blind person to get an in depth description of the image
- Poorly supported by both browsers and screen readers. Almost certainly will be either removed or deprecated in XHTML5