[英]How can I make an image autosize with the changing of the browser size on the fly?
I have a chart that I am creating on the backend and then passing to the front end as an image. 我有一个要在后端创建的图表,然后作为图像传递到前端。 I need this image to shrink/grow as I change the window size of my browser but cannot get it to adapt to the screen size.
在更改浏览器的窗口大小时,我需要缩小/增大该图像,但无法使其适应屏幕尺寸。 Anyone know how I can get it to auto resize with the changing size of the browser window?
有人知道如何通过更改浏览器窗口的大小来自动调整大小吗?
equip.cshtml: equip.cshtml:
<img src="@Url.Action("DrawChart")" alt="Drawing chart with HTML Helper" />
equip.cs 装备
public ActionResult DrawChart()
{
var chart = new Chart(width: 450, height: 300)
.AddSeries(
chartType: "Doughnut",
xValue: new[] { "10 Records", "20 Records", "30 Records", "40 Records" },
yValues: new[] { "50", "60", "78", "80" })
.GetBytes("png");
return File(chart, "image/bytes");
}
Add this to the top of the view or the template. 将其添加到视图或模板的顶部。
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Depending on your Css, this should work. 根据您的CSS,这应该可以工作。 Take a look at bootstrap examples and this should give you a better idea.
看一下引导程序示例,这应该为您提供一个更好的主意。 Fixed properties for example will not help you.
例如,固定属性将无济于事。
Lots of examples of responsive designs out there. 有很多响应式设计的例子。
i think we need a responsive design here... 我认为我们需要在这里进行响应式设计...
i just gave an answer on resize image on changing the screen size 我只是在改变屏幕尺寸时对调整图像大小给出了答案
check out Making background images responsive - fullpage.js 签出使背景图像具有响应性-fullpage.js
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.