Percentage heights refer to the computed height property of the parent element. See specification . When setting only min-height: 100% in the body element according to my answer to the related question, the height property remains untouched with its default value auto . The min-height does not affect the calculated value of the height property.
Because of this, min-height: 100% on your element does not have a parent height for the link, and therefore it will not work. After you set height: 100% in the body element, your element can refer to this height to calculate its own percentage value.
How to fix this depends on what type of layout you are trying to achieve. The sole purpose of setting min-height: 100% in the body element is to allow it to expand when the height of the content exceeds the content area of ββthe viewport, which results in a scroll bar. If your content is only the height of the viewport, or you do not want the body create scrollbars, it is as simple as replacing min-height: 100% with height: 100% with body .
source share