当我用正确的代码加载主页时,我看不到字形.
<button type="button" class="btn btn-default" aria-label="Left Align">
<span class="glyphicon glyphicon-align-left" aria-hidden="true"></span>
</button>
<button type="button" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-envelope" aria-hidden="true"></span> Star
</button>
<i class="glyphicon glyphicon-search"></i>
<a href="#"><span class="glyphicon glyphicon-star"></span> Star</a>
Run Code Online (Sandbox Code Playgroud)
我有字体/app/assets/fonts/bootstrap.
在applications.js文件中:
//= require bootstrap-sprockets
//= require bootstrap
Run Code Online (Sandbox Code Playgroud)
在application.css.scss文件中:
@import "bootstrap-sprockets";
@import "bootstrap";
Run Code Online (Sandbox Code Playgroud)
在Gemfile文件中:
gem 'bootstrap-sass', '~> 3.3.3'
gem 'sprockets-rails'
gem 'sass-rails', '~> 5.0'
Run Code Online (Sandbox Code Playgroud)
在_glyphicons.scss文件中:
@font-face {
font-family: 'Glyphicons Halflings';
src: url(if($bootstrap-sass-asset-helper, twbs-font-path('#{$icon-font-path}#{$icon-font-name}.eot'), '#{$icon-font-path}#{$icon-font-name}.eot'));
src: url(if($bootstrap-sass-asset-helper, twbs-font-path('#{$icon-font-path}#{$icon-font-name}.eot?#iefix'), '#{$icon-font-path}#{$icon-font-name}.eot?#iefix')) format('embedded-opentype'), …Run Code Online (Sandbox Code Playgroud)