Thursday, July 26, 2012

a hack is still a hack

One problem with using divs with background images instead of proper imgs is divs don't have an exact equivalent of the "alt" tag, for screen readers and webcrawlers.

I found a coworker using "text-align:-9999px;" for the div -- this moved the text off the page but allowed him to use an image instead. (He was concerned about some of the nuance of the font and character rendering.)

It's a clever idea, but I think not a good practice. It smelled a bit off to me, and as I research it I see some bots like Google consider it a bit of a red flag.

A good trick to know of, but I'm not recommending it.

No comments:

Post a Comment