CSS按比例缩放图片防止撑破页面
.content-width {MARGIN: auto;WIDTH: 600px;} .content-width img{MAX-WIDTH: 100%!important;HEIGHT: auto!important;width:expression(this.width > 600 ? "600px" : this.width)!important;}
如上,假设正文的宽度为600像素,当里面的图片宽度超过600时,自动按比例缩放。兼容IE6.
.content-width {MARGIN: auto;WIDTH: 600px;} .content-width img{MAX-WIDTH: 100%!important;HEIGHT: auto!important;width:expression(this.width > 600 ? "600px" : this.width)!important;}
如上,假设正文的宽度为600像素,当里面的图片宽度超过600时,自动按比例缩放。兼容IE6.