2015-04-19 66 views
1

所以我在div裏面有一個button。我想製作font-weight: bold,所以我把它放在CSS中。我啓動了該網站,並且該按鈕的文本不是加粗。然後我用Firebug檢查它並且font-weight: bold甚至不在那裏?當我在螢火蟲中手動輸入時,我的文字變成加粗,就像我想要的那樣。不按css屬性的按鈕

我與引導工作,這裏是按鈕的CSS:

.btn-primary { 
    background: url("../img/bg-nav.png") repeat-x scroll left bottom #198901; 
    color: #ffffff; 
    font: 17px "bowlby_oneregular",sans-serif !important; 
    font-weight: bold; 
    text-transform: uppercase; 
} 

我覺得很奇怪,它並沒有使用Firebug顯示出來,可是當我把它放在那裏有它的Firebug工作

+3

如果您將'font'分割爲'font-size'和'font-family',或者如果您移除了'!important',它會有效。 – Xufox

+0

它可以在Chrome和Firefox上使用。 http://jsfiddle.net/a_incarnati/gcnwcf7e/ –

+0

@Xufox這是它謝謝你!有什麼辦法可以將其標記爲我的問題的答案? – RandomPerson

回答

2

解決辦法有兩個:

刪除!important

​​3210

斯普利特速記屬性了:

font-size:17px; 
font-family:"bowlby_oneregular",sans-serif; 
font-weight:bold; 

確切的解決方案取決於你想究竟如何應用字體。但我只是簡單地重寫你的代碼,這樣!important永遠不會變得必要。