为字体图标添加白色背景



我想用白色背景填充问号图标。正如您在我的例子中看到的,图标周围仍然有一个小的白色边框。怎么可能缩小背景,只填充问号?

body {
background: lightgreen;
font-size: 126px;
}
.fa-question-circle:before {
background: white;
border-radius: 100%;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<i class="fas fa-question-circle"></i>

您可以使用背景图像和如下所示的线性渐变

body {
background: lightgreen;
font-size: 126px;
}
.fa-question-circle:before {
background-image: linear-gradient(#fff,#fff);
background-repeat: no-repeat;
background-size: 50% 75%;
background-position: center;
}
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.3.1/css/all.css" integrity="sha384-mzrmE5qonljUremFsqc01SB46JvROS7bZs3IO2EmfFsd15uHvIt+Y8vEf7N7fWAU" crossorigin="anonymous">
<i class="fas fa-question-circle"></i>

最新更新