max & min
CSS 中对于 height/width, max-height/max-width, min-height/min-width 的用法的说明
container:150px | inside-content:100px | inside-content:200px |
---|---|---|
height | 150px | 150px |
max-height | 100px | 150px |
min-height | 150px | 200px |
- 设置
height
的情况下,无论inside content
大于或小于容器高度均不影响容器高度; - 设置
max-height
的情况下,inside content
小于容器高度则容器高度等于inside content
高度; - 设置
min-height
的情况下,inside content
大于容器高度则容器高度等于inside content
高度;
所以在设计页面中有 footer
的情况下,需要使用 min-height