这样做最好的方法是什么?
以下是我现在在做什么
<asp:Image Height="725" width="500" ID="img_DocPreview" />
更新:改为这个但有同样的问题。如果我只指定高度,它将保持宽高比,但它超过了我想要的最大宽度500px。
<img style="height:725px;width:500px;" id="img_DocPreview" src="Images/empty.jpg" />
尝试
<img style="height:725px;max-width:500px;width: expression(this.width > 500 ? 500: true);" id="img_DocPreview" src="Images/empty.jpg" />
这应该将高度设置为725px,但是防止宽度超过500px。宽度表达式围绕ie6工作,被其他浏览器忽略。