Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save foreverplay/cd085dcc3eb2f73a075078ad8df07cb6 to your computer and use it in GitHub Desktop.
Save foreverplay/cd085dcc3eb2f73a075078ad8df07cb6 to your computer and use it in GitHub Desktop.
子元素无法继承父元素min-height:100%的问题
父元素设置min-height,子元素高度设置100%,取不到值
只有当父级元素满足min-height:1000px;设置的条件才触发;浏览器默认是不会触发的,所以子元素的100%的高度继承就失效了。
min-height 是在 height 计算之后再套用的.
解决方法:给父元素加绝对定位,然后子元素加相对定位,这样子元素的高度就会根据父元素的高度进行计算
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment