簡體   English   中英

預先添加到表單組中的輸入字段以進行引導

[英]Prepend to input field in form-group for bootstrap

我有一個使用以下屬性的引導表單:

<div class="form-group">
                            <label for="recipient-email" class="col-form-label">Email</label>
                            <input type="email" name="email" placeholder="info@traxr.net" class="form-control" id="email">
                        </div>

....

我有一個額外的輸入字段,我想在其中添加https://前綴。

顯然,它必須被包裝在一個input-group div 中,這會弄亂輸入字段的寬度以及錯誤 label 現在放在同一行

有沒有辦法將前綴添加到輸入字段,同時仍將所有代碼保留在form-group容器中?

電子郵件與域輸入字段供參考。

默認情況下,Bootstrap 提供與輸入組相同的組件。在這里您可以找到更多https://getbootstrap.com/docs/4.6/components/input-group/

並回答你的問題。

 <div class="input-group mb-3">
   <div class="input-group-prepend">
     <span class="input-group-text" id="basic- addon3">https://</span>
  </div>
   <input type="text" class="form-control" id="basic-url" aria-describedby="basic-addon3">
</div>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM