.q-team-images {
width: 6.4rem;
height: auto;
padding-bottom: 1rem;
}
上面的css样式是否会让图片的高度与其png图片的高度一致?
最佳答案
是的,如果它不破坏你的图像的比例,因为你已经设置了一个 width
它会按你的宽度缩放,所以它可能不会(取决于你的图像高度.
您还可以使用 max-width
和 max-height
.q-team-images {
max-width: 1280px; //your images max width
max-height: 720px; // your images max height
height: auto;
width: auto;
padding-bottom: 1rem;
}
关于html - 是否高度 : auto for image stretch as much as the height of the png?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44269291/