图像缩放 [英] Image scaling

查看:56
本文介绍了图像缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



您知道是否可以将图像放大

到最大宽度/高度,但保持其纵横比。


我的两个想法是:

- < img src =" toto.jpg" style =" max-width:200px; max-height:200px;" />

但它没有保持比例


- < div style =" width:为200px;身高:200px;">< img src =" toto.jpg />< / div>

但图片流在div外面

Sincerly ,


-

Stephane D''Alu

解决方案

Stephane D''Alu写道:

你知道是否可以将图像放大到最大宽度/高度,但保持其纵横比。







-

David Dorward http://dorward.me.uk/


Stephane D' 'Alu< sd *** @ sdalu.com>写道:

你知道是否可以将图像放大到最大宽度/高度,但保持其纵横比。




最大值是什么?您可以设置宽度:100%,并且保留

高度未设置,您要求浏览器保持比例。


但浏览器通常会执行在缩放图像方面做得很糟糕。除了

a之外的任何东西都非常简单的装饰可能会被扭曲。


-

Yucca, http://www.cs.tut.fi/~jkorpela/


在消息< sl ******************* @ rork.sdalu.com> ;, Stephane D''Alu

< sd *** @ sdalu.com>写道


你知道是否可以将图像放大到最大宽度/高度,但保持其纵横比。
<我有两个想法:
- < img src =" toto.jpg" style =" max-width:200px; max-height:200px;" />
但它没有保持比例

- < div style =" width:200px;高度:200px;">< img src =" toto.jpg />< / div>
但图片流在div外面

Sincerly,


< img src =" toto.jpg" width =" 100%">

-

杰克



Do you know if it is possible to have an image to be scalled
to a maximum width/height, but with keeping its aspect ratio.

The two ideas I had were:
- <img src="toto.jpg" style="max-width: 200px; max-height: 200px;"/>
but it doesn''t keep the ratio

- <div style="width: 200px; height: 200px;"><img src="toto.jpg/></div>
but the image flow outside the div
Sincerly,

--
Stephane D''Alu

解决方案

Stephane D''Alu wrote:

Do you know if it is possible to have an image to be scalled
to a maximum width/height, but with keeping its aspect ratio.



No

--
David Dorward http://dorward.me.uk/


Stephane D''Alu <sd***@sdalu.com> wrote:

Do you know if it is possible to have an image to be scalled
to a maximum width/height, but with keeping its aspect ratio.



Maximum with respect to what? You can set width: 100%, and by leaving
height unset, you''re asking browsers to maintain the proportions.

But browsers generally do an awful job in scaling images. Anything but
a very simple ornament probably gets distorted.

--
Yucca, http://www.cs.tut.fi/~jkorpela/


In message <sl*******************@rork.sdalu.com>, Stephane D''Alu
<sd***@sdalu.com> writes


Do you know if it is possible to have an image to be scalled
to a maximum width/height, but with keeping its aspect ratio.

The two ideas I had were:
- <img src="toto.jpg" style="max-width: 200px; max-height: 200px;"/>
but it doesn''t keep the ratio

- <div style="width: 200px; height: 200px;"><img src="toto.jpg/></div>
but the image flow outside the div
Sincerly,


<img src="toto.jpg" width="100%">
--
Jake


这篇关于图像缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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