自定义图标字体有问题。它在 Safari 和 Chrome 之间呈现不同。它在 Safari 中似乎低 1-2 个像素。我可以以某种方式让它在两个浏览器中呈现相同的内容吗?
通过从 Sketch 导出 16 x 16 px SVG 创建图标字体,然后将它们导入 IcoMoon 并将优化指标设置为 16 自动。
IconMoon 上的网格
铬 OS X
Safari OS X
现场示例:http: //jsfiddle.net/QQ7mV/
HTML:
<a href="" class="button increase">+</a>
CSS:
* {
box-sizing: border-box;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-o-box-sizing: border-box;
-ms-box-sizing: border-box;
}
@font-face {
font-family: "icons";
src: url("http://cl.ly/Qo0T/icons.ttf") format("truetype");
font-weight: normal;
font-style: normal;
}
a {
display: block;
text-decoration: none;
outline: none;
}
.button {
width: 115px;
height: 37px;
color: #333333;
font-size: 14px;
font-weight: bold;
text-align: center;
line-height: 35px;
margin: 0 auto 20px auto;
background-color: #edeef0;
background-repeat: no-repeat;
border-radius: 4px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
-o-border-radius: 4px;
-ms-border-radius: 4px;
transition-property: background-color, opacity;
-webkit-transition-property: background-color, opacity;
-moz-transition-property: background-color, opacity;
-o-transition-property: background-color, opacity;
-ms-transition-property: background-color, opacity;
transition-duration: 0.2s;
-webkit-transition-duration: 0.2s;
-moz-transition-duration: 0.2s;
-o-transition-duration: 0.2s;
-ms-transition-duration: 0.2s;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
-o-user-select: none;
-ms-user-select: none;
-webkit-user-drag: none;
}
.button.increase, .button.decrease {
display: inline-block;
vertical-align: top;
width: 23px;
height: 23px;
font-family: "icons";
font-size: 8px;
font-weight: normal;
line-height: 1;
padding: 8px 0 0 0;
-webkit-font-smoothing: antialiased;
}
.button.increase {
margin: 13px 5px 0 11px;
}
.button.decrease {
margin: 13px 0 0 0;
}