max-width:-webkit-fit-content ie 8 equivalent?

前端 未结 4 523
感动是毒
感动是毒 2021-02-08 18:59

Are there any hacks for max-width:-webkit-fit-content; for ie 8?

Trying to get a child div to not take up the whole width of the parent and this works well

相关标签:
4条回答
  • 2021-02-08 19:41

    It might depends on the situation:

    I had a block-level element with width: fit-content;. As this doesn't work on IE, the element was taking the full available width (as expected).

    But I wanted it to just adjust its size to its content.

    Finally, i fixed it with:

    display: inline-flex;
    
    0 讨论(0)
  • 2021-02-08 19:43

    Not yet; keep watching http://caniuse.com/#feat=intrinsic-width &

    https://wpdev.uservoice.com/forums/257854-internet-explorer-platform/suggestions/6263702-css-intrinsic-sizing

    0 讨论(0)
  • 2021-02-08 19:45

    The closest I can think of is floating your elements. Not exactly alike, but probably sufficiently alike;) You need to set extra margin though, but this should be no problem with a conditional stylesheet.

    .textbox {
        background-color: yellow;
        float:left;
        clear:left;
    }
    

    Your modified fiddle

    0 讨论(0)
  • 2021-02-08 19:47

    From demosthenes.info, I learned I can simply use

    display: table;
    

    instead of

    width: fit-content;
    

    Check the link however about problems with whitespaces. It does not apply to my case, and simply replacing width: fit-content with display: table solved my problem quite easily.

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