首頁 >web前端 >css教學 >如何在 Bootstrap 4 和 5 中新增圖示到搜尋輸入?

如何在 Bootstrap 4 和 5 中新增圖示到搜尋輸入?

Linda Hamilton
Linda Hamilton原創
2024-11-12 02:19:021020瀏覽

How to Add Icons to Search Inputs in Bootstrap 4 and 5?

使用Icon Bootstrap 搜尋輸入

Bootstrap 在版本4 中不再支援Glyphicons,因此想要向搜尋輸入新增圖示的使用者必須找到替代方案方法。

Bootstrap 5 Beta(2021 年)更新)

<div class="input-group">
    <input class="form-control border-end-0 border rounded-pill" type="text" value="search"><p><strong>Bootstrap 4(原始解決方案)</strong></p>
<p>使用🎜>使用🎜></p>使用🎜>使用🎜>使用🎜><pre class="brush:php;toolbar:false"><div class="input-group col-md-4">
    <input class="form-control py-2" type="search" value="search">使用🎜>使用🎜>使用🎜><p>使用🎜>使用🎜>使用🎜> Bootstrap 4 輸入組元素:<strong></strong></p> <pre class="brush:php;toolbar:false"><div class="input-group col-md-4">
    <input class="form-control py-2 border-right-0 border" type="search" value="search">內部輸入邊框:<p><strong></strong></p>
<pre class="brush:php;toolbar:false"><div class="input-group">
    <input class="form-control py-2 border-right-0 border" type="search" value="search">無背景的輸入組文字:<p><strong></strong>無背景的輸入組文字:</p>
<pre class="brush:php;toolbar:false"><div class="row no-gutters">
    <div class="col">
        <input class="form-control border-secondary border-right-0 rounded-0" type="search" value="search"><p>無背景的輸入組文字:<strong></strong></p>無背景的輸入組文字:<pre class="brush:php;toolbar:false"><div class="input-group">
    <span class="input-group-prepend">
        <div class="input-group-text bg-transparent border-right-0">
            <i class="fa fa-search"></i>
        </div>
    </span>
    <input class="form-control py-2 border-left-0 border" type="search" value="..."><p><strong> </strong></p>
<pre class="brush:php;toolbar:false"><div class="input-group is-invalid">
    <input class="form-control" type="search" value="">無裝訂線間距的網格(行>列) :前置圖示:前置圖示:前置圖示:前置圖示:前置圖示:前置圖示:前置圖示:前置圖示:前置圖示: 驗證圖示:</div>

以上是如何在 Bootstrap 4 和 5 中新增圖示到搜尋輸入?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

bootstrap using border background input
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
上一篇:為什麼帶有浮動子項的容器高度為零?下一篇:為什麼帶有浮動子項的容器高度為零?

相關文章

看更多