CSS flexbox layout: child with height 100%?

心不动则不痛 提交于 2020-01-16 05:33:06

问题


I am trying to use a 'Holy Grail'-style layout with flexbox - fixed header above columns that fill the page. I am basing my code on this source.

My problem is that a child element with height:100% inside of the main cell does not pick up the height of the layout. The following demo shows what I mean, I want the red element to take up the full height (tested in Webkit):

http://jsbin.com/dafac/2/

How can I fix this?


回答1:


I've used the second solution mentioned in How to make flexbox children 100% height of their parent? using "position:absolute; bottom:0;" to create a full height child of the flex item because "height:100%" requires the flex item to have an explicit height.



来源:https://stackoverflow.com/questions/25435060/css-flexbox-layout-child-with-height-100

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!