Created
July 27, 2018 08:59
-
-
Save foreverplay/cd085dcc3eb2f73a075078ad8df07cb6 to your computer and use it in GitHub Desktop.
子元素无法继承父元素min-height:100%的问题
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
父元素设置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