How to add alt text to background images? Making background images accessible

前端 未结 3 747
迷失自我
迷失自我 2021-01-22 08:38

I have a site that is displaying many of its images as background images using background-size: cover to size them to completely fill the element while cropping off

3条回答
  •  一生所求
    2021-01-22 09:17

    This means they need alt text in order to be accessible to screen readers and other assistive technologies.

    You perfectly right to point out that users may use assistive technologies which are not screen readers. Also, any method using sr-only CSS class must not be used as the sole way to ensure that the textual information may be accessed to every user.

    For instance, people with low vision may want to discard all images which would appear blur and display their text alternative instead.

    The object-fit property works for images since Edge 16 so it's no longer a problem for 92% of browsers, and a fallback can be provided for older browsers.

提交回复
热议问题