简体   繁体   中英

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?

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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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