Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 with ff, chrome and safari; hoping there's some hack to get it to work with ie 8 as well.

Fiddle showing the behavior: http://jsfiddle.net/XtZq9/ Code for the behavior I want in ie8:

#wrap {
    background-color: aqua;
    width:300px;
    height: 50px;
    padding-top: 1px;
}

.textbox {
    background-color: yellow; 
    max-width: intrinsic;
    max-width:-webkit-fit-content;
    max-width:  -moz-max-content;
    margin-top: 2px;
}

<div id="wrap">
     <div class="textbox">
        Here is some text
    </div>  
    <div class="textbox">
        Here is other, longer, text
    </div>  
</div>  
like image 327
HelloWorld Avatar asked Jul 03 '13 02:07

HelloWorld


1 Answers

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.

like image 91
Veverke Avatar answered Nov 16 '22 03:11

Veverke