2015-09-28 73 views
1

我一直在使用白手起家Glyphicons幾天的字體和我的家人嘗試添加一些文本的按鈕裏面有glyphicon圖標:引導Glyphicons更改按鈕

<button type="button" class="btn btn-default pull-left" data-toggle="collapse" data-bind="attr:{'href':'#'+'TableA'}"> 
    <span class="glyphicon glyphicon-th-list" aria-hidden="true" data-bind="text:' Details'"></span> 
</button> 

它顯示我的表在單擊時。我需要的文本設置爲宋體,但如果我改變它裏面bootstrap.css或我補充一下:

<span class="glyphicon glyphicon-download-alt" aria-hidden="true" data-bind="text:' Download', style:{fontFamily: 'Arial'}"></span> 

它改變了文本字體家庭爲宋體,但glyphicon圖標消失。 我在做什麼錯?使用圖形圖標可以更改按鈕內文本的字體系列?

回答

1

您可以嘗試將要更改文本內部字體的文本放入元素中。然後,將類或id分配給跨度,並在css文件中將跨度的字體系列更改爲所需的那個,這不應該影響雕文。

/S

+0

感謝@ ste3333。你是第一個給我這個想法的人,所以我會將你的答案標記爲解決我的問題的人。再次感謝! :) – Dana

+0

:) 希望它爲你工作! – 2Lach

+0

是的。它效果很好! :) – Dana

2

只需使用作爲東西

<button type="button" class="btn btn-default pull-left" data-toggle="collapse" data-bind="attr:{'href':'#'+'TableA'}"> 
    <span class="glyphicon glyphicon-th-list" aria-hidden="true"></span>&nbsp; 
    <span style="--your style--">Download</span> 
</button> 
+0

謝謝@Rohit庫馬爾。你的答案和前一個一樣,但你的代碼。我不能標出兩個答案,所以我會標記另一個答案,因爲它是第一個回答我的問題的人。再次感謝! :) – Dana

+1

不是問題,討論是學習的關鍵..快樂編碼:) –

+0

你是對的。謝謝! :) – Dana

4

後予發泡短<span/>定義消耗的一個(<span></span>)的字體是固定的。

原始版本(無效字體):

 <button type="button" class="btn btn-default"> 
      <span class="glyphicon glyphicon-send"/> 
      &nbsp;Send message 
     </button> 

修正版本:

 <button type="button" class="btn btn-default"> 
      <span class="glyphicon glyphicon-send"></span> 
      &nbsp;Send message 
     </button> 

我真的不明白爲什麼這個工作對我來說...

+0

你救了我的一天,隊友!謝謝 – oskarko

+2

glyphicon類基本上是一種字體(有點像舊的wingdings字體,除了wingding完全替換了字母),所以它應用了它自己的字體設置。當關閉時,不再應用這些設置(即圖形字體),恢復到下一個封閉元素應用的字體。僅供參考,因爲這是你的最佳答案恕我直言。 – Inyoka