2015-05-20 33 views
0

我以前使用的是下載bootstrap.min.css文件版本,我已經加入如果我使用MaxCDN中的bootstrap.min.css文件而不是下載的引導程序文件,如何加載我的字體集中的新自定義圖標?

.glyphicon-location2:before{content:"\e948"} 
在線

該文件(這是包含在一個網站模板的自定義編輯)。我已經使用icomoon更新了我的glyphicon字體集,並且在我的項目文件中引用了下載的字體集。現在,我想使用CDN版本bootstrap.min.css加快我的頁面加載速度,但似乎只引用了默認的圖標,因爲我的自定義圖標在網頁輸出中不存在。

  1. 預加載的CDN版本「應該」導致多快的速度增加?
  2. 我在哪裏可以從我的自定義本地文件字形集中提取圖標的圖形引用?是否必須覆蓋默認字體源並指向本地字體集,類似於此線程中的答案(請記住,我沒有使用SCSS或節點)?

    how does $icon-font-path works in bootstrap scss?

我可以通過添加

@font-face { font-family:'Glyphicons Halflings'; src:url('fonts/glyphicons-halflings-regular.eot'); src:url('fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('fonts/glyphicons-halflings-regular.woff') format('woff'), url('fonts/glyphicons-halflings-regular.ttf') format('truetype'), url('fonts/glyphicons-halflings-regular.svg#glyphicons-halflingsregular') format('svg') }

style.css文件覆蓋默認glyphicons,還是我必須重寫bootstrap.min.css字體處理其他地方?

+1

[Bootstrap 3 Glyphicons CDN]的可能重複(http://stackoverflow.com/questions/18222849/bootstrap-3-glyphicons-cdn) – kaz

回答

0

下面是我能夠使字形圖標出現的一段CSS代碼。嘗試使用如下所示的font-family。 FYI這增強引導的手風琴

.panel-heading .accordion-toggle:after { 
/* symbol for "opening" panels */ 
font-family: 'Glyphicons Halflings'; /* essential for enabling glyphicon */ 
content: "\e114"; /* adjust as needed, taken from bootstrap.css */ 
float: right;  /* adjust as needed */ 
color: #328ED1;   /* adjust as needed */ 
} 

.panel-heading .accordion-toggle.collapsed:after { 
/* symbol for "collapsed" panels */ 
content: "\e080"; /* adjust as needed, taken from bootstrap.css */ 
} 
0

所以我做了一些實驗和「發現」,是的,宣告了新glyphicons在我的自定義styles.css文件@font-face(這是我下面的CDN引導進口環節在我的HTML爲了以覆蓋默認值)的作用就像在我原始下載的bootstrap.min.css文件中聲明的字體一樣。呃...沒有創意的要點。

相關問題