【发布时间】:2014-11-08 20:32:56
【问题描述】:
我在 PHP/MySQL 数据库中创建了一个图片库。如何以相同的图像大小以纵横比显示图像?
这是我的css代码:
img
{
display: block;
max-width: 100%;
max-height: 100%;
margin: auto;
-webkit-transition: all 2s ease-out;
transition: all 2s ease-out;
left: 0;
right: 0;
top: 0;
bottom: 0;
}
在此代码中,图像的比例是正确的,但它显示的图像大小不同。我想在以下位置显示整个图像:
width:150px;
height:200px;
我该怎么做?
【问题讨论】:
-
所有图像的纵横比是否相同或不同?