Limiting Image Width With CSS If Width Greater then Maximum

Lets say you want a maximum width of an image to be 100 pixel. If an image has width more then 100 pixel then you want the width set to 100, if the width is less then or equal to 100 you want it as is.

Here is a css class that would do just that.

.image100 {max-width:100px;widthxpression(this.width > 100 ? 100: true);}

Now you can use the class on images you need to enforce this width restriction.

<img src="myimage.gif" class="image100" alt="" />