简体   繁体   English

字体真棒图标对齐

[英]Font Awesome icons alignment

I am using bootstrap-sass and font-awesome-sass-rails gems and have successfully eradicated duplicate icons (from glyphicons) by adding to bootstrap-and-overrides.css.scss: 我正在使用bootstrap-sass和font-awesome-sass-rails宝石,并通过添加到bootstrap-and-overrides.css.scss中,成功消除了重复图标(来自glyphicons):

[class^="icon-"] {
  background-image:none;
}

However, now I am having the problem of slightly out of line icons.. The glyphicons were perfect before. 但是,现在我遇到的问题是图标略有偏离。.字形图标以前很完美。 Now I am seeing: 现在我看到:

在此处输入图片说明

I would like to move the icons down a pixel or 2. Please help. 我想将图标下移一个像素或2。请帮助。 Thanks. 谢谢。

Similar to the directions for LESS found on the Font-Awesome Integration section , one should remove the SASS for the glyph icons altogether, rather than just load the Font-Awesome SASS on top of it. 与在“超赞字体集成”部分中找到的LESS指示相似,应该完全删除字形图标的SASS,而不是仅在其顶部加载“超赞字体SASS”。 I strongly discourage any approach that merely tries to save appearances by overriding CSS rules that don't need to be there in the first place. 我强烈不鼓励任何试图通过覆盖不需要的CSS规则来保存外观的方法。

I don't use Rails, but I assume the rough outline would be: 我不使用Rails,但我认为大概是:

  1. Checkout a copy of the bootstrap-sass repo . 签出bootstrap-sass repo的副本。

  2. Locate the _bootstrap.scss file. 找到_bootstrap.scss文件。

  3. Replace the @import "bootstrap/sprites"; 替换@import "bootstrap/sprites"; with @import "your/path/to/font-awesome"; @import "your/path/to/font-awesome"; , where your/path/to/ contains the font-awesome.scss . ,其中your/path/to/包含font-awesome.scss

  4. Recompile the bootstrap.scss (don't forget to minify!). 重新编译bootstrap.scss (不要忘记缩小!)。

Im using the twitter-bootstrap-rails gem. 我正在使用twitter-bootstrap-rails gem。 I had to comment out: 我不得不评论:

  @iconSpritePath: asset-path("twitter/bootstrap/glyphicons-halflings.png");

from bootstrap_and_overrides.css.less file 从bootstrap_and_overrides.css.less文件中

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM