max-width for images in IE

 

max-width for images in IE

To use max-width the syntax is:

selector {max-width:value;}

Internet Explorer up to version 6 doesn’t support the max-width property but has the ability to perform javascript like functions on it’s CSS so you can fake max-width with it. Here’s the syntax:

selector {width: expression(this.width > value ? value: true);}

example for IMG html tag:

img {
max-width:390px;
/* IE Image max-width */
width: expression(this.width > 390 ? 390: true);
}

NOTE: max-width property does NOTHING for the file size if used with an image.


4 Responses to “max-width for images in IE”

  1. thanks, works perfectly.

  2. great!

  3. thanks, I’ve been searching for a straight forward method and this works perfectly.

  4. Yay! Thanks.

Post a Comment



We use third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you.