I just read this entry but I am still not quite sure about the reasoning for the choices. In particular, I'd like to understand exactly what is meant by "content" and "non-content/other" images and why I should use img when I am adding content images to my site and background-image when adding non content images.
Here is my understanding of "content" and "non-content" image:
Content images are those images that are dynamically generated. For example, images of users that are displayed on their profile page and images that are uploaded to a photo gallery, a blog, etc.
Non-content images are those non-dynamic images that are part of the site design. They're "baked in" if you will. E.g. logos, image links, image buttons, etc.
If my definitions are correct - and please tell me if they're not - then it seems to me the reasoning for using each would be as follows (although this isn't exactly apparent in the article linked to, hence my follow up question):
Non content images tend to not change as much as content images. I.e. logos, button images, links with images, etc. tend to stay the same. They're only changed if the site owner decides to redesign the site.
Content images, on the other hand, tend to change frequently. New images are uploaded often, users change their profile images and photo galleries, etc.
So because of the dynamic nature of content images, they need an img tag that can dynamically be modified by whatever tech stack the site is driven by. The not so frequently changing images don't need image tags. They can be loaded from the site design assets directly in the css file for performance and easy maintainability.
Is that about right or am I missing something?
CSS is used for describing the presentation semantics (the look and formatting). So if you use css to show your images, it means (in theory) that you are showing that image only to style some element to look better or express itself better. If in the future you would change the skin of your web site, it is likely you would consider changing those images as well.
Content images on the other hand would be part of the information/data of your web site. If you show some user's photo it is nothing to do with styling. It is as important information as user's name, surname or age.
the img tag can be fetched by SEO, and it can using alt, but background-image can't
so, if you wanna some pics fetched by google, bing, or other, you should using img tag.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With