Use the "img" element to embed an image given by the "src" attribute. Use the "alt" attribute to provide equivalent content when the image cannot be processed or when image loading is disabled.
Attributes for "img"
|'Standard' Attributes||"alt", "border", "decoding", "height", "ismap", "src", "usemap", and "width"|
|New HTML5 Attributes||"crossorigin"|
|New HTML 5.1 Attributes||"sizes" and "srcset"|
|New HTML 5.2 Attributes||"referrerpolicy"|
|Obsolete Attributes||"vspace", "name", "lowsrc", "longdesc", "hspace", and "align"|
- Use of the "height" and "width" attributes is recommended with the "img" element. Using these attributes generally result in faster and smoother (less jumpy) rendering.
Accessibility Information & Tips
Search Engine Optimization (SEO)
- Using the "alt" attribute for images is not just good for accessibility, it's good for search engines too. Use the "alt" attribute to describe images but use relevant keywords and search terms in the description when appropriate, but don't overdo it by cramming in too many keywords. Consider using/adding graphic images, photos, or illustrations on important keyword-targeted pages with the important keywords used in the alt text.
- Following accessibility standards may improve search engine rankings. Use "alt", "title", and table "summary" attributes whenever relevant and possible. Use keywords and search terms in them but keep them accurate. Using CSE HTML Validator's optional accessibility checking can help.
- Image searches can be a significant source of visitors and traffic. Therefore, try to use keywords when naming images, and separate keywords with hyphens (not underscores).
Search Engine Links (for more information)