Knowledge point: When the height of an element is set to a percentage, its actual height is expanded by the actual content height , or inherited by the parent element . If the parent element does not have a height set, then the percentage height of the child element has no effect.
Wrong way:
body{
height:100%;
//虽然body的高度为100%,但是父元素没有高度。
//所以body的height:100%无效。
}
Correct spelling:
html,body{
height:100%;