After optimizing my website for mobile using media queries, I noticed that unnecessary images were still being downloaded even though they are hidden with CSS. This was causing the page loading times to slow down.
To address this issue, I decided to replace inline images with divs displaying background images wherever possible. By hiding these divs with media query CSS for the mobile version, I could eliminate the problem of excessive image downloads.
While I understand there may be potential downsides to this approach, as discussed in detail in a post on When to use IMG vs. CSS background-image?, certain images like the company logo and staff photos will remain as inline images.
Despite researching extensively on mobile optimization through media queries, I have not come across many instances where this solution has been implemented, even though it seems quite logical for managing images as either inline or background elements.
It is worth noting that in my experiments with iPhones and Android devices (I plan to test on Blackberrys soon), I discovered that setting "display: none" to the parent div, rather than the div containing the background image itself, effectively prevents background images from being downloaded.
In an ideal scenario, websites would be built with a mobile-first approach. However, in situations like this one (and often others), there are limitations on how much the original site can be modified.
Thank you.