The purpose of CSS is to help web developers to define and apply graphics and layout, separated from the actual content.
However, it seems like CSS can tweak pretty much anything (graphics wise) on a website - apart from the source attribute of an <img>
-tag.
To achieve 100% separation between style and content (which we all want, right?) shouldn't we define image sources in the CSS as well?
I know that CSS can't do this (no support of changing src-attribute for images) but there are work-arounds, such as using <div>
with backgrounds instead of <img>
. However, by doing that, won't it break search engines?
My question is. Is using instead of <img>
to achive 100% separation between style and content a reasonable action?
<img />
tags are intended to be content, not style.<img />
is supposed to be used for something like a photo accompanying an article.
UI graphics should be done using CSS backgrounds.
An image is content - e.g. diagrams. Style is just to make the page pretty but adds nothing to the content (syntax/semantics) of the document.
Sometimes images are content and not just style... and that's when you use an 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