How to force child div to be 100% of parent div's height without specifying parent's height?

前端 未结 26 2005
刺人心
刺人心 2020-11-22 06:52

I have a site with the following structure:

<
26条回答
  •  孤城傲影
    2020-11-22 07:32

    NOTE: This answer is applicable to legacy browsers without support for the Flexbox standard. For a modern approach, see: https://stackoverflow.com/a/23300532/1155721


    I suggest you take a look at Equal Height Columns with Cross-Browser CSS and No Hacks.

    Basically, doing this with CSS in a browser compatible way is not trivial (but trivial with tables) so find yourself an appropriate pre-packaged solution.

    Also, the answer varies on whether you want 100% height or equal height. Usually it's equal height. If it's 100% height the answer is slightly different.

提交回复
热议问题