-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Height and width inside a flex container #4649
Comments
Apparently the fix for #1157, adding a 100% with for the inner container and the SVG, also works for flex box width, but not height: |
Is there a workaround for the height issue in the meantime? |
I've had success putting <div id="parent"> // flex-sized, but height 0
<div id="chart-container"> // flex 1, overflow hidden, display flex
<div id="chart"> // flex 1, overflow hidden And this seems to work (in Chrome) in all cases. It gets really tricky when mixing flex and width/height, since they're not really meant to work together. |
Thanks so much for your response!!! It worked :) |
I also had it working by using height:100% on the "chart-container", which was under a flexed item. For some reason height:0 did not work for me (but I had to use width:0 for some cases so flex layout does not use the child content). |
Issue with the height came across when tested app in Chrome( latest 64.0 ). The highchart container won't fit inside the parent. It would just overflow (not like scrolling but grew bigger than parent container). The structure of html can be represented as follows (.flexed_item is a child of div with display set to flex) - .flexed_item{ width: 100%; height: 100%;} -> .chart-container{ width:100%; height:80%} -> .highchart This thing was working fine in firefox. But not in chrome. .flexed_item{ height: 0; width:100%; flex: 1 1 100%; display: flex; }-> .chart-container { flex:1; display:flex; } -> .highchart And now it is working in both ( chrome and firefox ) finally. |
I solved it using <div id="row" style="display:flex">
<div id="col" style="display:flex; flex-direction: column;">
<div id="chart-container-outer" style="position:relative; flex-grow:1">
<div id="chart-container" style="position:absolute; left:0; top: 0; bottom:0; right:0; overflow:hidden"></div>
</div>
</div>
<div id="col sibling" style="display:flex"> // same height
</div>
</div> |
@dabalyan |
Hi @maitrivasa, ps. please do not duplicate your comments and subjects because of confusing. |
I am sorry. I have removed my post now |
When there's more than one element inside a flex container, width and height don't shrink when changing window size.
flex-direction:row demo
flex-direction:column demo
The text was updated successfully, but these errors were encountered: