It was something that I had never pay attention to... I do not use much the ALT attribute of IMG tag. Most of the cases I used to leave it empty. I believed that it's purpose was to give an description, tooltip ot the image. But this is wrong!
The real purpose of "ALT" defined by the World Wide Web Consortium is:
For user agents that cannot display images, forms, or applets, this attribute specifies alternate text. The alt attribute must be specified for the IMG and AREA elements. It is optional for the INPUT and APPLET elements.
For a description (tooltip) of an image you have to use the HTML standard attribute title="whatever".
Every HTML tag has own specific attributes, but and Standard Attributes (for all tags with a few exceptions).
Not valid in base, head, html, meta, param, script, style, and title elements.
| Attribute | Value | Description |
|---|---|---|
| class | class_rule or style_rule | The class of the element |
| id | id_name | A unique id for the element |
| style | style_definition | An inline style definition |
| title | tooltip_text | A text to display in a tool tip |
Not valid in base, br, frame, frameset, hr, iframe, param, and script elements.
| Attribute | Value | Description |
|---|---|---|
| dir | ltr | rtl | Sets the text direction |
| lang | language_code | Sets the language code |
| Attribute | Value | Description |
|---|---|---|
| accesskey | character | Sets a keyboard shortcut to access an element |
| tabindex | number | Sets the tab order of an element |
Add your comment here.
What is this blog about? - A blog about sharing wisdoms mostly connected with web development.
I truly hope that you will find something useful here. Cheers, Raya.