View Full Version : experiment: prevent images from displaying in eg IE3

07-07-2005, 01:23 PM
is there anyway to prevent
eg <img src="decorativeimage.jpg" height="20" width="40" alt=""">

from displaying in old browsers

I know backgrounds on divs do not display since eg IE3 cannot read id (or class ??) so these images are hidden from old non CSS browsers.

But a <img> to be hidden from old browsers is a whole lot more difficult

only possibility to set the height and width attributes to zero and override these in CSS with their real dimensions


myImg.img {height: 20px !important; width: 40px !important;}

<img class="myImg" src="decorativeimage.jpg" height="0" width="0" alt=""">

Bill Posters
07-07-2005, 01:51 PM
Unless you're actually expecting a number of IE3 visitors, I wouldn't worry about it. Statistically speaking, IE3 has fallen off the radar in all but a handful of sites.

What you could/should be doing is to develop a simple, semantic structure to your markup and using css to bring in decorative imagery.
If an image is considered to be content, then it should be implemented as an img element, and should ideally be available to any visitor regardless of their browser.

Browsers which can't handle CSS well will still get the undecorated page, but will still be able to access the textual and image-based content.

07-07-2005, 03:10 PM
to hide CSS from old CSS-buggy browsers, use the @import command.