是否有“width:-moz-fit-content;”的css跨浏览器值? [英] Is there a css cross-browser value for "width: -moz-fit-content;"?

查看:139
本文介绍了是否有“width:-moz-fit-content;”的css跨浏览器值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些div以中心位置适合他们的内容宽度

I need some divs to be center-positioned and to fit their content width at the same time.

我现在这样做:

.mydiv-centerer{

  text-align: center;

  .mydiv {
    background: none no-repeat scroll 0 0 rgba(1, 56, 110, 0.7);
    border-radius: 10px 10px 10px 10px;
    box-shadow: 0 0 5px #0099FF;
    color: white;
    margin: 10px auto;
    padding: 10px;
    text-align: justify;
    width: -moz-fit-content;
  }
}

现在,最后一个命令 -moz-fit-content;完全我需要的!

Now, the last command "width: -moz-fit-content;" is exactly what I need!

只有问题是它只能在Firefox上使用。

Only problem is.. it works only on Firefox.

我也尝试使用 :inline-block;,但我需要这些div的行为像div。也就是说,下一个div应为 ,而不是内联

I also tryed with "display:inline-block;", but I need these divs to behave like divs. Namely, every next div should be under, and not inline, the previous.

跨浏览器解决方案?

推荐答案

最后我简单地使用:

display: table;

这篇关于是否有“width:-moz-fit-content;”的css跨浏览器值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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