-1

我想让高度与宽度为 20% 的图像的宽度成比例。请帮助我使用 CSS

4

2 回答 2

3

你可以这样使用:

width: 20%;
height: auto;
-ms-interpolation-mode: bicubic;

对于Internet Explorer 7,您需要使用-ms-interpolation-mode使其看起来成比例。

笔记:

-ms-interpolation-mode属性仅适用于拉伸图像。例如,如果图像的自然宽度为 ,200x200但页面设计者指定高度和宽度应为400x400,则除非另有说明,否则将使用最近邻算法将图像拉伸到新尺寸。

阅读更多: http: //msdn.microsoft.com/en-us/library/ie/ms530822 (v=vs.85).aspx

于 2012-11-06T10:05:28.677 回答
1

只需width: 20%;将高度设置为默认值,即auto.

于 2012-11-06T10:03:43.463 回答