My sincerest apologies if such a thread already exists in this forum, but I wanted to get some feedback on using images as background images as opposed to foreground images in my page markup, from an accessibility standpoint.
Let me just outline the two techniques i’m talking about. Say for example I had a banner image which had some stock image as the background and then some text on top of it with some specific styling, that means it can’t be overlayed on top of the image using text in the markup. Let’s say this text is “MyBusiness services”.
Using a background image:
HTML:
<div id="somebanner">MyBusiness services</div>
CSS:
#somebanner { width: 100px; height: 100px; line-height: 100px; background: url(/path/to/img); text-indent: -999em; }
Using a foreground image:
HTML:
<img src="path/to/img" alt="MyBusiness services" />
What I’m looking for are the pros and cons from an accessibility perspective, of using each method. I already have my own ideas, but I want to see what other people think.