【问题标题】:text-align center for opera - css歌剧的文本对齐中心 - css
【发布时间】:2015-04-29 11:06:57
【问题描述】:

如果 Chrome 是这样的:

.text-center {
  text-align: -webkit-center;
}

和火狐:

.text-center {
  text-align: -moz-center;
}

歌剧怎么样?

.text-center {
  text-align: -o-center;
}

不工作。

更新:

HTML:

  .container
    .text-center.label-margin
      %h3
        .bubble LEADERSHIP

我的气泡类的 CSS。

.bubble {
  position: relative;
  width: 170px;
  height: 45px;
  padding: 11px 0 0 0 !important;
  background-color: #333333 !important;
  font-style: normal !important;
  font-family: 'Fira Sans', sans-serif;
  font-size: 25px;
  font-weight: 600;
  -webkit-border-radius: 5px;
  -moz-border-radius: 5px;
  border-radius: 5px;
  color: #fff;
}

看起来像在 OPera

【问题讨论】:

    标签: css opera


    【解决方案1】:

    您不需要为 text-align 属性添加前缀。您可以简单地使用:

    text-align:center;
    

    改为(应该适用于所有浏览器)。

    进一步阅读:

    • W3.org documentation 在 text-align 属性上。
    • 这是一篇很好的 CSS-Tricks 文章,您可能会觉得有用。
    • 如果我们谈论任何属性,caniuse... 是目前“最好的”浏览器兼容性网站之一,其中包含几乎所有 css 属性的信息。

    另请注意:Border-radius 不需要前缀(并且已经有一段时间没有这样做了),而使用 !important 被认为是不好的做法,所以我个人建议改掉使用的习惯它。

    【讨论】:

      【解决方案2】:

      试试这样:Demo

      .center{
      text-align-center;   
      }
      

      不需要专门为所有浏览器使用,因为它几乎被所有浏览器接受

      【讨论】:

        猜你喜欢
        • 2010-11-02
        • 2015-05-16
        • 1970-01-01
        • 2020-12-19
        • 2018-10-31
        • 2018-09-15
        • 1970-01-01
        • 1970-01-01
        • 2019-11-21
        相关资源
        最近更新 更多