How to make flex-end work in IE11

后端 未结 3 1981
伪装坚强ぢ
伪装坚强ぢ 2020-12-11 21:37

I tried to make justify-content: flex-end; work, for overflowing-hidden DIV content, in IE11, without success.

After trying several combinations I creat

3条回答
  •  旧巷少年郎
    2020-12-11 22:10

    As others said, forget flex CSS for IE up to version 11.0. I slighly changed your first suggested code, both CSS and HTML, highlightning the changed/added rows:

    .token-container {
        width: 200px;
        white-space: nowrap;
        overflow: hidden;
        padding: 5px;
        box-shadow: 1px 1px 2px 1px silver inset;
    
        display: flex;
        flex-direction: row;
    }
    /* you have to nest your tokens inside another div with large fixed margin-left, flex-shrink: 0 (important), and no border nor padding */
    .intermediate {
        flex: 1 0 auto;
        padding: 0;
        border: 0;
        margin: 0 0 0 -1000px;
        /* added: constant amount - the more, the better
           the perfect value is the workarea width, but, if available,
           you can use the maximum-width of a token element */
    }
    .token {
        display: inline-block;
        border: 1px solid silver;
        margin: 1px 3px 0 0;
        border-radius: 4px;
        height: 19px;
        padding: 0 3px;
    
        float: right; /* added: you need to reverse your tokens! (litte effort) */
    }
    bacon
    leberkäs
    pancetta
    hamburger
    t-bone

提交回复
热议问题