:在内容占用空间不同之前,在windows / mac Chrome中

时间:2015-12-08 13:01:48

标签: css macos google-chrome

Chrome for Windows和Chrome for Mac处理CSS中添加的内容的方式略有不同:之前。

以下是以下内容的CSS:

.s-smiley:before {
  content: "\EA20";
}

 .s-smiley {
  color: white;
  background: #D8D8D8;
  margin-top: 46px;
  margin-right: 16px;
  padding: 9px;
  font-size: 37px;
  line-height: 29px;
}
 .s-smiley {
  background: #50E3C2;
}

.s:before {
    display: inline-block;
    font-family: symbols;
    font-style: normal;
    font-weight: 400;
    line-height: 37px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

问题是在Windows中 - 内容似乎被推下并占用空间。其他人都知道这个问题吗?它有解决方法吗?

Chrome for Windows:

Chrome for Windows

Chrome for Mac:

Chrome for Mac

1 个答案:

答案 0 :(得分:0)

如果没有完整的代码,很难说,但试试这个:

.s:before {
    display: block;
    float:left;
    font-family: symbols;
    font-style: normal;
    font-weight: 400;
    height: 37px;
    line-height:37px;
    overflow:hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

http://jsfiddle.net/kmrjy11d/

还要确保您的字体文件正确