在野生动物园中字体 - 令人敬畏的图标堆叠问题

Jin*_*ian 10 html css css3 font-awesome

我的字体很棒的图标让我有这个奇怪的问题.我希望我的图标有一个圆形边框.我不想使用,border: 1px solid因为图标边框看起来很模糊.我已经通过这里stacking method所描述的font-awesome 的" " 实现了这个平滑的边界

由于我的字体是64px大,这个fa-circle-thin图标边框太厚.为了避免我使用box-shadow.

我的问题是我的图标边框不统一.

在chrome中,左边的边框有点厚.(不知何故,我无法在小提琴/片段中复制这个问题,因此可以忽略它.)

铬

但在野生动物园中,右边的边界很厚.

在此输入图像描述

如何摆脱这个问题?我不想使用,-webkit-text-stroke因为它有限的浏览器支持.任何帮助深表感谢 :)

小提琴

这是我的代码.

a{
  text-decoration: none;
}
.social-block .fa {
    font-size: 64px;
}

span.fa-stack {
    width: 64px;
    height: 64px;
}

.social-block .fa-stack-1x:before {
    font-size: 24px;
    vertical-align: top;
    line-height: 64px;
}
.social-block .fa-stack-1x{
    box-shadow: inset 0 0 0px 7px #fff;
    position: absolute;
    top: -1px;
}
.social-block a:hover .fa-stack-1x{
    box-shadow: none;
}
.social-block a:hover .fa-stack-1x:before {
    width: 50px;
    height: 50px;
    line-height: 50px;
    left: 7px;
    top: 7px;
    position: absolute;
}

.social-block .fa {
    color: #CC1E4A;
    border-radius: 50%;
    -webkit-transition: all ease .25s;
    -moz-transition: all ease .25s;
    -o-transition: all ease .25s;
    transition: all ease .25s;
    font-size: 64px;
}

.social-block a:hover .fa-circle-thin {
    background: none;
}
.social-block a:hover .fa-stack-1x:before {
    background: #CC1E4A;
    display: block;
    border-radius: 50%;
}
.social-block a:hover .fa-stack-1x {
    color: #fff;
}
Run Code Online (Sandbox Code Playgroud)
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/>
<div class="social-block">
  <a href="#">
      <span class="fa-stack fa-lg">
        <i class="fa fa-circle-thin fa-stack-2x"></i>
        <i class="fa fa-facebook fa-stack-1x"></i>
     </span>
  </a>
  <a href="#">
      <span class="fa-stack fa-lg">
        <i class="fa fa-circle-thin fa-stack-2x"></i>
        <i class="fa fa-twitter fa-stack-1x"></i>
     </span>
  </a>
  <a href="#">
      <span class="fa-stack fa-lg">
        <i class="fa fa-circle-thin fa-stack-2x"></i>
        <i class="fa fa-linkedin fa-stack-1x"></i>
     </span>
  </a>
</div>
Run Code Online (Sandbox Code Playgroud)

Sti*_*ers 1

您无法更改当前 Font Awesome 图标的粗细,但是设计师还创建了一组名为Black Tie的商业多粗细图标字体,其中包括浅色字体。

作为一种解决方法,我建议只使用普通图标并使用 绘制圆圈,而不是堆叠图标border-radius。保持简单,并且易于更新。

Jsfiddle示例

.social-block a {
  position: relative;
  text-decoration: none;
  display: inline-block;
  margin: 10px;
  color: #cc1e4a;
  background-color: #fff;
  border: 1px solid #cc1e4a;
  border-radius: 50%;
  box-sizing: border-box;
  width: 50px;
  height: 50px;
  text-align: center;
  transition: all .25s ease;
  transition-property: color, box-shadow;
}
.social-block a:hover {
  box-shadow: 0 0 0 3px #cc1e4a;
  background-color: #cc1e4a;
  color: #fff;
}
.social-block .fa {
  font-size: 24px;
  height: 100%;
}
/* center icon vertically */
.social-block .fa:after {
  content: "";
  height: 100%;
  display: inline-block;
  vertical-align: middle;
}
/* box-shadow white line fixes */
.social-block a:hover:after {
  content: "";
  position: absolute;
  left: -3px; right: -3px;
  top: -3px; bottom: -3px;
  border-radius: 50%;
  border: 6px solid #cc1e4a;
}
Run Code Online (Sandbox Code Playgroud)
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css" rel="stylesheet"/>

<div class="social-block">
  <a href="#"><i class="fa fa-facebook"></i></a>
  <a href="#"><i class="fa fa-twitter"></i></a>
  <a href="#"><i class="fa fa-linkedin"></i></a>
</div>
Run Code Online (Sandbox Code Playgroud)