Height: 100% inside min-height: 100%

前端 未结 1 1624
执念已碎
执念已碎 2020-12-16 04:50

How would you get a height: 100% inside a min-height: 100% working?

相关标签:
1条回答
  • 2020-12-16 05:07

    I usually use:

    position: absolute;
    height: 100%;
    

    And on the outer div:

    position: relative;
    min-height: 100%;
    

    Using static positioning doesn't work, because the browser needs the outer div's height to calculate the inner div's height. But it doesn't know the outer div's height until it has calculated the inner div's...

    However, my solution can't be used in many situations. Maybe someone else has a better one.

    0 讨论(0)
提交回复
热议问题