html - How can a flex item be made to fit the height of its parent when using IE11? -
in example below cannot find way using css flex model make div b fill height of div a. when flex-direction column child div still collapses when no heights specified.
.a { display: -webkit-box; display: -ms-flexbox; display: flex; background: #00b; -ms-flex-direction: column; -webkit-box-orient: vertical; -webkit-box-direction: normal; flex-direction: column; } .b { background: #b00; -ms-flex: 1 1 0%; -webkit-box-flex: 1; flex: 1 1 0%; } <div class="a"> <div class="b"> wish big dad </div> </div>
revised answer based on question edit.
this 1 of ie's many flex bugs, won't recognize parents height under circumstances.
in case, when using flex container column direction, if use unitless value flex-basis you'll same result cross browsers.
.a { display: -webkit-box; display: -ms-flexbox; display: flex; background: #00b; -ms-flex-direction: column; -webkit-box-orient: vertical; -webkit-box-direction: normal; flex-direction: column; } .b { background: #b00; -ms-flex: 1 1 0; -webkit-box-flex: 1; flex: 1 1 0; } <div class="a"> <div class="b"> wish big dad </div> </div> if sole purpose make items fit height of parent, recommend use longhand flex-grow: 1 instead.
stack snippet
.a { display: -webkit-box; display: -ms-flexbox; display: flex; background: #00b; -ms-flex-direction: column; -webkit-box-orient: vertical; -webkit-box-direction: normal; flex-direction: column; } .b { background: #f66; -ms-flex-grow: 1; -webkit-box-flex: 1; flex-grow: 1; } <div class="a"> <div class="b"> big dad </div> </div> here a fiddle sample, showing both row , column version.
Comments
Post a Comment