css 样式中height100%失效问题
父元素height:100px;子元素设置height:100%;并没有让子元素等于父元素的高度
解决
让子元素脱离文档流,设置absolute/fixed,这时在设置height:100%;子元素就会等于父元素的高度
.father{
height:64px;
}
.son{
position:absolute;
height:100%;
}
父元素height:100px;子元素设置height:100%;并没有让子元素等于父元素的高度
让子元素脱离文档流,设置absolute/fixed,这时在设置height:100%;子元素就会等于父元素的高度
.father{
height:64px;
}
.son{
position:absolute;
height:100%;
}