Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Mar 2005
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    experiment: prevent images from displaying in eg IE3

    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

    eg

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

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

  • #2
    Senior Coder
    Join Date
    Feb 2003
    Posts
    1,665
    Thanks
    0
    Thanked 27 Times in 25 Posts
    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.

  • #3
    Senior Coder
    Join Date
    Feb 2004
    Location
    Edinburgh
    Posts
    1,352
    Thanks
    0
    Thanked 0 Times in 0 Posts
    to hide CSS from old CSS-buggy browsers, use the @import command.
    *keep it simple (TM)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •