嗨,我需要一個下拉串列,其中將使用圖示列出邊框選項。要顯示圖示,我正在使用引導庫。下面是我正在嘗試的代碼
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
</head>
<body>
<select>
<option>

</option>
</select>
</body>
我從Bootstrap docs獲得了 Unicode 。但圖示未在下拉串列中呈現。我在這里做錯了什么?
uj5u.com熱心網友回復:
您還必須在這些元素上設定字體系列。在這種情況下,您需要在選項和選擇元素上使用它,因為它顯示了選擇。然后,您必須覆寫文本選項。問題是所選值的字體錯誤。
不過,我不確定你的目標是什么。選項需要文本才能訪問。
.has-icons {
font-family: "bootstrap-icons";
}
.has-icons .other-font {
font-family: arial, sans-serif;
}
<head>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
</head>
<body>
<select class="has-icons">
<option></option>
<option class="other-font">Standard font option</option>
</select>
</body>
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/445621.html
