1

I have a triply-nested flex layout (horizontal flex, with two nested vertical flex, with a further nested horizontal flex). The innermost (horizontal) layout has flex-wrap: wrap set so that items will wrap if the component gets too narrow. This works fine on Chrome, Firefox, and Edge, but (shocker) not on IE 11.

I see a similar issue here, but in that case display: table was involved, which is not the case here. I wasn't able to get the proposed workaround to work here.

Following is how it renders in Chrome (gray boxes wrap): Friendly Chrome

And here's how it renders in IE 11 (gray boxes don't wrap): Intransigent IE 11

Here's the code for this sample:

#top {
    display: flex;
    height: 300px;
    width: 60%;
    margin: auto;
}
.vert {
    border: 1px solid #888;
    border-radius: 2px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    margin-right: 5px;
}
.vert:last-child {
    margin-right: 0;
}
.top {
    background-color: red;
    height: 30px;
}
.mid {
    flex-grow: 1;
    background-color: yellow;
}
.bot {
    background-color: green;
    display: flex;
    flex-wrap: wrap;
}
.block {
    background-color: #888;
    width: 80px;
    height: 30px;
    margin: 5px;
}
<!DOCTYPE html>
<html>
    <head>
        <title>Wrap Test</title>
    </head>
    <body>
        <div id="top">
            <div class="vert">
                <div class="top"></div>
                <div class="mid"></div>
                <div class="bot">
                    <div class="block"></div>
                    <div class="block"></div>
                    <div class="block"></div>
                </div>
            </div>
            <div class="vert">
                <div class="top"></div>
                <div class="mid"></div>
                <div class="bot">
                    <div class="block"></div>
                    <div class="block"></div>
                    <div class="block"></div>
                </div>
            </div>
        </div>
    </body>
</html>

Does anybody know a workaround for this?

Michael Benjamin
  • 346,931
  • 104
  • 581
  • 701
Aron
  • 1,552
  • 1
  • 13
  • 34
  • 1
    Add `width: 100%` to `.vert`: https://jsfiddle.net/d0fmq63c/2/ – Michael Benjamin Feb 17 '18 at 01:46
  • @Michael_B - I _swear_ I tried that! I got sloppy and didn't test it in my sample; I'll have to see if I missed some aspect of the real code. Thanks... – Aron Feb 17 '18 at 09:30

0 Answers0