2014-10-06 65 views
1

我爲我的rails應用程序使用了bootstrap 3。在查看頁面中,引導程序圖標未顯示。Bootstrap 3:圖標不顯示

我的文件夾結構看起來像。

app/assets/stylesheets/bootstrap.min.css 

app/assets/fonts/ ###font files 

app/assets/images/ ###image files 

和內部bootstrap.min.css我打電話FONT-FAMILY如下

@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')} 

請糾正我,如果我這樣做是錯誤的。

UPDATE:

代碼來顯示圖標:

<a title="edit" href="<%= edit_customer_customer_path(cust, from: "admin")%>"> 
<i class="icon-pencil bigger-130"></i> 
</a> 
+0

確保你在'app/assets/fonts /'目錄中有'glyphicons-halflings-regular.eot'和其他文件。 – Surya 2014-10-06 13:04:36

+0

是的,它有.. – 2014-10-06 13:07:08

回答

7

引導3使用不同類的圖標,你正在使用icon-*類是用於引導2.在引導3,你應該使用.glyphicon.glyphicon-* CSS類:

<span class="glyphicon glyphicon-pencil"></span> 

Migrating to v3.x

1

有什麼不對根據你輸入的字體和你的項目結構的結構方式。當您嘗試打印圖標時,很可能存在問題。你可以發佈一個片段顯示你如何打印圖標?

更新: 根據您的代碼示例更新,似乎您使用Bootstrap 2圖標類,而在3有一個字體家庭,而不是PNG精靈,所以你應該顯示圖標這個方法:

<i class="glyphicon glyphicon-pencil"></i>