Bootstrap Glyphicon,如何改变体重?

时间:2017-10-25 17:01:35

标签: css twitter-bootstrap

我没有看到我在CSS属性font-weight中指定的任何值的任何更改。你知道如何解决吗?

提前致谢



struct A { 
  explicit A(int i);
  A() : A(load_something()) {}
};

.glyphicon-custom {
  font-weight: lighter;
}




1 个答案:

答案 0 :(得分:0)

您需要将font-weight应用于::before伪元素,因为它是内容的编写位置。

在下面的代码段中,我分别给图标赋予了字体权重100和900.

.glyphicon-custom::before {
  font-weight: 100;
}

.glyphicon-custom-2::before {
  font-weight: 900;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<div class="form-group has-feedback"><input type="search" class="form-control"/><span class="glyphicon glyphicon-search form-control-feedback glyphicon-custom"></span></div>


<div class="form-group has-feedback"><input type="search" class="form-control"/><span class="glyphicon glyphicon-search form-control-feedback glyphicon-custom-2"></span></div>