我正在使用引導程式和 CSS 來設計我的網站,但我似乎無法弄清楚如何更改按鈕中文本的字體樣式和粗細。這是我的一些代碼
<button type="button-apple" class="btn btn-light btn-lg download-button"><i class="fab fa-google-play"></i> Download</button>
我想將字體更改為更粗,以便文字更易于閱讀,因為在我的螢屏上它們顯示為非常細的線條。
提前致謝。
uj5u.com熱心網友回復:
每當您嘗試使用庫時,請記住,您正在覆寫它們已經定義的樣式。在這種情況下,僅定義新樣式(例如顏色、字體粗細等)是行不通的。而且,請不要嘗試修改他們已經在使用的類名。
您可以通過多種方式解決它
第一種方法是從您自己的示例中添加一個新類:here ->
.my-button-class并嘗試進行樣式設定。然后使用!important它,它將覆寫您想要的樣式。
例如
您的 HTML 將如下所示:
<button type="button-apple" class="btn btn-light btn-lg download-button my-button-class">
<i class="fab fa-google-play"></i> Download
</button>
第一種方法的CSS
.my-button-class{
font-weight: bolder !important;
font-size: 2rem !important;
color: blue !important;
};
例如,使用
specificitywhich 呼叫標簽內的類的第二種方法:button.my-button-class設定樣式而不是使用!important,這也是一個非常好的解決方案。
第二種方法的CSS
button.my-button-class{
font-weight: bolder;
font-size: 2rem;
color: blue;
};
希望它能解決你的問題。:)
謝謝
uj5u.com熱心網友回復:
您可以將按鈕文本包裹在錨點中,然后使用一個span專案:
<a href="#" class="btn btn-light btn-lg download-button">
<i class="fab fa-google-play"></i>
<span style="font-weight:bolder;">Download</span>
</a>
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/341351.html
