WebAIM - Web Accessibility In Mind

E-mail List Archives

alt text contrast question

for

From: Sarah Ferguson
Date: Sep 26, 2017 1:38PM


one more question from our developer (hopefully the last for a while):

Is there any reason this might be bad practice for accessibility:

adding a copy of the alt text as a child pseudo-element of the image
(img::after {content: attr(alt);}) and styling this copy using CSS. The
"true" alt text is in the HTML but is not styled. The copy was hidden by
the image and would only be seen if images were off. The copy overlaid the
alt text itself so with images off, you'd only see the copy. This mechanism
allowed for a black background mask behind white text, which would always
show up. We did this because with images off, some alt text was not high
contrast enough.

thanks