A flex container has four children, each with a flex-basis of 25% an a min-width. flex-flow is set to row wrap. Browsers other then Safari handle this as expected: if the min-width is reached, it wraps the the next item to the next row. In Safari it overflow the container.
See demo here: http://codepen.io/lbilharz/pen/aJbkI
JADE
h1 Why this ain't wrappin' in mobile-safari? .flex for i in ['one','two','three','four'] .item h2=i
Stylus
.flex display flex flex-wrap wrap flex-direction row padding 1em background lightyellow .item flex 1 0 25% padding 1em box-sizing border-box min-width 15em
Any ideas?
If you add content and/or width and/or flex-basis to one or more items, and the items grow to exceed 800px (the width of the container), then your flex items will wrap. But note, they won't wrap based on your re-sizing of the browser window, because the container doesn't occupy width: 100% of the viewport.
Safari versions 9 and up support the current flexbox spec without prefixes. Older Safari versions, however, require -webkit- prefixes. Sometimes min-width and max-width cause alignment problems which can be resolved with flex equivalents.
As you only want the text itself to wrap you need to use flex-wrap: nowrap; to keep . right on the same line. The text will automatically wrap when there is not enough space.
You can use flex-basis: 100% for item you want to wrap in new line.
Per a comment on bugs.webkit.org, it seems the solution is simple!
If your style is
div.flex { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; -webkit-flex-direction: row; flex-direction: row; } div.flex .item { min-width: 15em; -webkit-flex: 1; flex: 1; }
you just need to add more explicitness to your flex
declaration. In fact, I think only one line needs to change like so
div.flex { display: -webkit-flex; display: flex; -webkit-flex-wrap: wrap; flex-wrap: wrap; -webkit-flex-direction: row; flex-direction: row; } div.flex .item { min-width: 15em; -webkit-flex: 1 1 15em; /* this */ flex: 1; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With