Safari 6 (iOS 6) flex layout doesn't wrap elements

前端 未结 1 1521
难免孤独
难免孤独 2021-01-28 23:20

I need the two boxes to be in columns. This works in other browsers I have tested but not in Safari 6 on iOS 6.

Example: http://jsfiddle.net/5FESj/1/

dis         


        
相关标签:
1条回答
  • 2021-01-29 00:19

    Demo

    HTML

    <div class="page-wrap">
        <div class="content1">
             <h1>DIV 1</h1>
        </div>
        <div class="content2">
             <h2>DIV 2</h2>
        </div>
    </div>
    

    CSS

    .page-wrap > div {
        width: 100%;
        height: 100px;
        background-color: lightBlue;
        border: 1px solid black;
    }
    .page-wrap {
        display: -webkit-box;
        /* OLD - iOS 6-, Safari 3.1-6 */
        display: -moz-box;
        /* OLD - Firefox 19- (doesn't work very well) */
        display: -ms-flexbox;
        /* TWEENER - IE 10 */
        display: -webkit-flex;
        /* NEW - Chrome */
        display: flex;
        /* NEW, Spec - Opera 12.1, Firefox 20+ */
    }
    .content1 {
        -webkit-box-ordinal-group: 1;
        /* OLD - iOS 6-, Safari 3.1-6 */
        -moz-box-ordinal-group: 1;
        /* OLD - Firefox 19- */
        -ms-flex-order: 1;
        /* TWEENER - IE 10 */
        -webkit-order: 1;
        /* NEW - Chrome */
        order: 1;
        /* NEW, Spec - Opera 12.1, Firefox 20+ */
        min-width:200px;
        width: 50%;
        /* No flex here, other cols take up remaining space */
        -moz-box-flex: 1;
        /* Without this, Firefox 19- expands to widest paragraph, overrides width */
    }
    .content2 {
        -webkit-box-ordinal-group: 2;
        /* OLD - iOS 6-, Safari 3.1-6 */
        -moz-box-ordinal-group: 2;
        /* OLD - Firefox 19- */
        -ms-flex-order: 2;
        /* TWEENER - IE 10 */
        -webkit-order: 2;
        /* NEW - Chrome */
        order: 2;
        /* NEW, Spec - Opera 12.1, Firefox 20+ */
        -webkit-box-flex: 2;
        /* OLD - iOS 6-, Safari 3.1-6 */
        -moz-box-flex: 2;
        /* Firefox 19- */
        /* For OLD syntax, otherwise collapses. */
        min-width:200px;
        -ms-flex: 2;
        /* TWEENER - IE 10 */
        -webkit-flex: 2;
        /* NEW - Chrome */
        flex: 2;
        /* NEW, Spec - Opera 12.1, Firefox 20+ */
        background: #ccc;
    }
    
    @media screen and (max-width: 500px) {
        .page-wrap {
            display: block;
        }
    }
    

    References : (1) (2)


    Demo

    css

    @media screen and (max-width: 500px) {
        .page-wrap {
            flex-direction: column-reverse;
        }
    }
    

    Refer

    0 讨论(0)
提交回复
热议问题