max-height和height

max-height和height

max-height和min-height一个是用来防止撑起的盒子太大,一个是用来防止撑起的盒子太小

但是,max-height:100%和height:100%在某些情况下也不一样

当width:100%的时候,一张图片,你使用height:100%,图片会撑起整个父级盒子

而你使用max-height,则会按比例撑起来,不破坏原来图片的百分比

你可能感兴趣的:(max-height和height)