简体   繁体   English

CSS:什么时候在图片上使用max-height / max-width?

[英]CSS: When to use max-height / max-width on images?

When does it make sense to use max-height or max-width on an image? 什么时候在图像上使用max-heightmax-width有意义?

Does it help if I don't specify the actual dimensions of the image because I don't know it. 如果我不知道图像的实际尺寸,是否有帮助?

It makes sense when you have images of unknown width (for example, user uploaded content) that you do not want to exceed a certain area. 当您有宽度不明的图像(例如,用户上传的内容)并且不想超出某个区域时,这是很有意义的。

If I remember correctly, the property is not supported by IE6. 如果我没记错的话,IE6不支持该属性。 It is however by IE7: Source 但是它是由IE7提供的: 来源

保留包含横向和纵向格式的图像列表的大小也是一个好习惯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM