简体   繁体   English

在 height: auto 之后设置 min-height 有什么影响?

[英]what effect does setting min-height after height: auto do?

What is the effect of setting min-height css property but also defining height: auto?设置 min-height css 属性但同时定义 height: auto 的效果是什么?

height: auto;
min-height: 300px;    

height: auto is the default value for height, so you'd only need to include it to override a height set somewhere else in the stylesheet. height: autoheight: auto的默认值,因此您只需要包含它来覆盖样式表中其他height设置的height For example, you might have:例如,您可能有:

div.box {
  height: 32rem;
}

div.box.special {
  height: auto;
  min-height: 32rem;
}

This would have the effect of allowing <div class="box special"></div> to expand past its 32rem minimum height if the content required it.如果内容需要,这将允许<div class="box special"></div>扩展超过其 32rem 最小高度。

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

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