歌剧的文本对齐中心 - css

text-align center for opera - css

如果 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我的泡泡class.

.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里的样子

您不需要为文本对齐添加前缀 属性。您可以简单地使用:

text-align:center;

相反(应该适用于所有浏览器)。

进一步阅读:

  • W3.org documentation 文本对齐 属性.
  • 这是一篇不错的 CSS-Tricks 文章,您可能会觉得有用。
  • 如果我们谈论任何 属性,caniuse... 是 'best' 浏览器兼容性网站之一,几乎所有 css 属性的信息。

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

这样试试:Demo

.center{
text-align-center;   
}

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