最大宽度:-webkit-fit-content,即8个等效值? [英] max-width:-webkit-fit-content ie 8 equivalent?

查看:384
本文介绍了最大宽度:-webkit-fit-content,即8个等效值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否存在针对最大宽度:-webkit-fit-content; 例如8的黑客?

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

试图让孩子的div不能占据父母的整个宽度,这对于ff,chrome和safari来说效果很好;希望有一些技巧使其也可以与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.

小提琴显示了该行为: http://jsfiddle.net/XtZq9/
我在ie8中想要的行为代码:

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>  


推荐答案

我能想到的最接近的是浮动元素。虽然不完全相同,但可能足够相似;)尽管您需要设置额外的边距,但这对于条件样式表应该没有问题。

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;
}

您修改过的小提琴

这篇关于最大宽度:-webkit-fit-content,即8个等效值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆