IE element width to min-content

前端 未结 3 1838
抹茶落季
抹茶落季 2020-12-31 05:14

I have the following container holding both an image and a text element.

3条回答
  •  灰色年华
    2020-12-31 05:47

    @Stack_of_Pancakes solution is lacking in that it adds an extra div which is a block element and spans the entire width, whereas the original width:min-content doesn't have this flaw. It can be fixed:

    HTML: (intact)

    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.

    CSS:

    .container {
        background-color: #EEEEEE;
        border: 1px solid #888888;
        padding: 0.3em;
        width: -moz-min-content;
        width: -webkit-min-content;
        display: -ms-inline-grid;
        -ms-grid-columns: min-content;
    }
    .container > span:nth-child(2) 
    {
        -ms-grid-row:2;
        display:inline-block;
    }
    

    http://jsfiddle.net/L28s7txr/6

提交回复
热议问题