当前位置: 代码迷 >> ASP.NET >> 为什么新闻内容里有图片,所设的行高就不起作用了啊该怎么处理
  详细解决方案

为什么新闻内容里有图片,所设的行高就不起作用了啊该怎么处理

热度:7774   发布时间:2013-02-25 00:00:00.0
为什么新闻内容里有图片,所设的行高就不起作用了啊.
为什么新闻内容里有图片,所设的行高就不起作用了啊.

------解决方案--------------------------------------------------------
HTML code
div下图片自适应解决方法2<img onload=""if(this.width>700) {this.resized=true; this.width=600;}div下图片自适应解决方法3转载aMiLiM'Blog//图片自适应大小并绝对居中对齐//函数 fImgageAuto//能在同一个ID下对单独图片进行自适应外框大小//Ver 2.1 最后更新07/08/27 by Amilimfunction fImageAuto(nID,nMaxWidth,nMaxHeight){   var objParentID =document.getElementById(nID);   var objImg =objParentID.getElementsByTagName("img");   var nImgNewRate =0;   var nImgOldRate =nMaxWidth/nMaxHeight;   for (i=0;i<objImg.length;i++) {     nImgNewRate =objImg[i].offsetWidth/objImg[i].offsetHeight;     if (nImgNewRate >=nImgOldRate) {       objImg[i].style.height =nMaxWidth/nImgNewRate +"px";       objImg[i].style.width =nMaxWidth +"px";       objImg[i].style.marginTop =Math.round((nMaxHeight-nMaxWidth/nImgNewRate)/2) +"px";
------解决方案--------------------------------------------------------
。。。 更好的办法 
是给 文章内容的上一级 加样式

#上一级div名字 img {
max-height:100px; 
max-width:300px;
}
  相关解决方案