如何在Asp.Net中修复图像控制的最大大小? [英] How to fix the maximum size of Image Control in Asp.Net?

查看:65
本文介绍了如何在Asp.Net中修复图像控制的最大大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网格视图中有一个图像,我想设置它的最大尺寸(分辨率),我想保持自动尺寸,但也修复了最大尺寸。我该怎么做?

解决方案

你可以在CSS中设置最大尺寸:

  img  InGrid  
{
max-宽度 50px;
max-height 50px;
}



它将让图像自动调整大小,直到达到其中一个尺寸。


为图像设置样式



< asp:Image ID =Image1runat =serverstyle =max-height:1000px; max-width:900px; height:auto; width:auto ; /> 


I have a image in Grid View and i want to set the maximum size(resolution) of that, i want to keep the size auto but also fix the maximum size. How can i do this?

解决方案

You can set the maximum size in CSS:

img.InGrid
{
max-width: 50px;
max-height: 50px;
}


It will let the image auto-size until it reaches one of those dimensions.


set a style for the image

<asp:Image ID="Image1" runat="server" style="max-height:1000px;max-width:900px;height:auto;width:auto;" />


这篇关于如何在Asp.Net中修复图像控制的最大大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆