Max-width: -webkit-fit-content, i.e. 8 equivalent?

Are there any hacks for max-width:-webkit-fit-content; , i.e. eight?

Trying to get a child div so as not to take the whole width of the parent, and this works well with ff, chrome and safari; hoping there would be a little hack to make it work with v. 8.

Script 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> 
+6
source share
3 answers

The closest I can think of is floating your elements. Not exactly alike, but probably pretty alike;) You need to install an extra margin, but that shouldn't be a problem with the conditional style sheet.

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

Modified violin

+3
source

From demosthenes.info , I found out that I can just use

 display: table; 

instead

 width: fit-content; 

Check the link, however, about problems with spaces. This is not relevant to my case and just replaces width: fit-content with display: the table solved my problem quite easily.

+4
source

Source: https://habr.com/ru/post/948598/


All Articles