Hacker News new | ask | show | jobs
by wbkang 3240 days ago
Some people would say use a div and background image CSS property. Not sure if that's the recommended solution though.
1 comments

Well - I would try to omit the image at all and use border style properties to do it. This way I would omit an request totally.

But maybe someone with real experience (not some hobbyist when it comes to front end work) should chime in.

Per https://www.w3.org/wiki/HTML/Elements/img

> A purely decorative image that doesn't add any information In general, if an image is decorative but isn't especially page-specific, for example an image that forms part of a site-wide design scheme, the image should be specified in the site's CSS, not in the markup of the document. However, a decorative image that isn't discussed by the surrounding text but still has some relevance can be included in a page using the img element. Such images are decorative, but still form part of the content. In these cases, the alt attribute must be present but its value must be the empty string.

I have always understood that (and earlier spec incarnations) to mean that <img alt=''> is correct for these cases.