Max Width and Max Height for Images via CSS

Lets you upload whatever dimension image you want and ensure that it can/will be displayed at a fixed max size limit, regardless of browser, and still maintain the aspect ratio. Some tweaks had to be made from the original documentation regarding IE8 and above. The code below works :)
CSS


.mainimage {
	max-width: 400px;
  	max-height: 190px;
	width: expression(this.width > 400 ? auto : true);
  	height: expression(this.height > 190 ? "190" : true);
}
Attached files

Posted by fbrefere001 on Monday October 29, 2012