减少 Glyphicon 的重量
Reduce the weight of a Glyphicon
有没有办法减少 Glyphicons 的 "weight"?
我正在使用“ok”Glyphicon <span class="glyphicon glyphicon-ok"></span>
,它显示如下:
有什么方法可以在不减小字体大小的情况下减少重量以产生更细的勾号?将 font-weight
更改为 lighter
没有任何效果。
使用白色描边是一种方法
-webkit-text-stroke: 2px white;
您可以在 ::before
伪元素上应用 font-weight
属性 来改变字体粗细:
.glyphicon {
font-size: 60px;
}
.glyphicon-light::before {
font-weight: 100;
}
.glyphicon-thick::before {
font-weight: 900;
}
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<span class="glyphicon glyphicon-search glyphicon-light"></span>
<span class="glyphicon glyphicon-search"></span>
<span class="glyphicon glyphicon-search glyphicon-thick"></span>
适用于不同 背景颜色。
$(document).ready(function() {
$( "[.fas || .glyphicon]" ).each(function( index ) {
var color = $(this).parent().css("background-color");
$(this).css("-webkit-text-stroke","2px "+color)
});
});
Notice : choose one of .fas
or .glyphicon
.
如果您不想全局应用,您也可以在 glyphicon
上使用不透明度。
<span style="opacity:0.25;" class="glyphicon glyphicon-ok"></span>
有没有办法减少 Glyphicons 的 "weight"?
我正在使用“ok”Glyphicon <span class="glyphicon glyphicon-ok"></span>
,它显示如下:
有什么方法可以在不减小字体大小的情况下减少重量以产生更细的勾号?将 font-weight
更改为 lighter
没有任何效果。
使用白色描边是一种方法
-webkit-text-stroke: 2px white;
您可以在 ::before
伪元素上应用 font-weight
属性 来改变字体粗细:
.glyphicon {
font-size: 60px;
}
.glyphicon-light::before {
font-weight: 100;
}
.glyphicon-thick::before {
font-weight: 900;
}
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<span class="glyphicon glyphicon-search glyphicon-light"></span>
<span class="glyphicon glyphicon-search"></span>
<span class="glyphicon glyphicon-search glyphicon-thick"></span>
适用于不同 背景颜色。
$(document).ready(function() {
$( "[.fas || .glyphicon]" ).each(function( index ) {
var color = $(this).parent().css("background-color");
$(this).css("-webkit-text-stroke","2px "+color)
});
});
Notice : choose one of
.fas
or.glyphicon
.
如果您不想全局应用,您也可以在 glyphicon
上使用不透明度。
<span style="opacity:0.25;" class="glyphicon glyphicon-ok"></span>