Image alt attribute best practices

后端 未结 10 1133
既然无缘
既然无缘 2020-12-20 16:51

What exactly is the intended use of the alt attribute on tags?

Should it describe the image, or should it provide meaningful re

10条回答
  •  抹茶落季
    2020-12-20 17:16

    From w3.org:

    While alternate text may be very helpful, it must be handled with care. Authors should observe the following guidelines:

    • Do not specify irrelevant alternate text when including images intended to format a page, for instance, alt="red ball" would be inappropriate for an image that adds a red ball for decorating a heading or paragraph. In such cases, the alternate text should be the empty string (""). Authors are in any case advised to avoid using images to format pages; style sheets should be used instead.
    • Do not specify meaningless alternate text (e.g., "dummy text"). Not only will this frustrate users, it will slow down user agents that must convert text to speech or braille output.

提交回复
热议问题