搜尋
首頁web前端Bootstrap教程bootstrap輸入框組有哪些

bootstrap輸入框組有哪些

推薦教學:Bootstrap教學

1、Bootstrap4 輸入框組

#  我們可以使用 .input-group 類別來新增表單輸入方塊中更多的樣式,如圖示、文字或按鈕。使用 .input-group-prepend 類別可以在輸入框的前面新增文字訊息, .input-group-append 類別新增在輸入方塊的後面。最後,我們還需要使用 .input-group-text 類別來設定文字的樣式。

<form>
  <div class="input-group mb-3">
    <div class="input-group-prepend">
      <span class="input-group-text">@</span>
    </div>
    <input type="text" class="form-control" placeholder="Username">
  </div>
  <div class="input-group mb-3">
    <input type="text" class="form-control" placeholder="Your Email">
    <div class="input-group-append">
      <span class="input-group-text">@runoob.com</span>
    </div>
  </div></form>

  效果圖:

bootstrap輸入框組有哪些

2、輸入框大小


#  使用 .input-group-sm 

類別來設定小型的輸入框, 

.input-group-lg bootstrap輸入框組有哪些類別設定大的輸入框:

<form>
  <div class="input-group mb-3 input-group-sm">
     <div class="input-group-prepend">
       <span class="input-group-text">Small</span>
    </div>
    <input type="text" class="form-control">
  </div></form><form>
  <div class="input-group mb-3">
    <div class="input-group-prepend">
      <span class="input-group-text">Default</span>
    </div>
    <input type="text" class="form-control">
  </div></form><form>
  <div class="input-group mb-3 input-group-lg">
    <div class="input-group-prepend">
      <span class="input-group-text">Large</span>
    </div>
    <input type="text" class="form-control">
  </div></form>

  3、多個輸入方塊與文字

<!-- 多个输入框 --><form>
  <div class="input-group mb-3">
    <div class="input-group-prepend">
      <span class="input-group-text">Person</span>
    </div>
    <input type="text" class="form-control" placeholder="First Name">
    <input type="text" class="form-control" placeholder="Last Name">
  </div></form>
 <!-- 多个文本信息 --><form>
  <div class="input-group mb-3">
    <div class="input-group-prepend">
      <span class="input-group-text">One</span>
      <span class="input-group-text">Two</span>
      <span class="input-group-text">Three</span>
    </div>
    <input type="text" class="form-control">
  </div></form>

4、複選框與單選方塊

<div class="input-group mb-3">
  <div class="input-group-prepend">
    <div class="input-group-text">
      <input type="checkbox"> 
    </div>
  </div>
  <input type="text" class="form-control" placeholder="RUNOOB"></div>
 <div class="input-group mb-3">
  <div class="input-group-prepend">
    <div class="input-group-text">
      <input type="radio"> 
    </div>
  </div>
  <input type="text" class="form-control" placeholder="GOOGLE"></div>

  效果圖:

bootstrap輸入框組有哪些

5、輸入框加按鈕群組

<div class="input-group mb-3">
  <div class="input-group-prepend">
    <button class="btn btn-outline-secondary" type="button">Basic Button</button> 
  </div>
  <input type="text" class="form-control" placeholder="Some text"></div>
 <div class="input-group mb-3">
  <input type="text" class="form-control" placeholder="Search">
  <div class="input-group-append">
    <button class="btn btn-success" type="submit">Go</button> 
  </div></div>
 <div class="input-group mb-3">
  <input type="text" class="form-control" placeholder="Something clever..">
  <div class="input-group-append">
    <button class="btn btn-primary" type="button">OK</button> 
    <button class="btn btn-danger" type="button">Cancel</button> 
  </div></div>

6、設定下拉式選單

<div class="input-group mt-3 mb-3">
  <div class="input-group-prepend">
    <button type="button" class="btn btn-outline-secondary dropdown-toggle" data-toggle="dropdown">
      选择网站    </button>
    <div class="dropdown-menu">
      <a class="dropdown-item" href="https://www.google.com">GOOGLE</a>
      <a class="dropdown-item" href="https://www.runoob.com">RUNOOB</a>
      <a class="dropdown-item" href="https://www.taobao.com">TAOBAO</a>
    </div>
  </div>
  <input type="text" class="form-control" placeholder="网站地址"></div>

  效果圖:bootstrap輸入框組有哪些

#########################7、輸入框組標籤###################################################################################################################################################### ########  在輸入框組透過在輸入框組外圍的label 來設定標籤,標籤的for 屬性需要與輸入框組的id 對應,點選標籤後可以聚焦輸入框:##### #
<label for="demo">Write your email here:</label><div class="input-group mb-3">
  <input type="text" class="form-control" placeholder="Email" id="demo" name="email">
  <div class="input-group-append">
    <span class="input-group-text">@runoob.com</span>
  </div></div>
###  ###效果圖:################

以上是bootstrap輸入框組有哪些的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
如何使用最新的Bootstrap版本和更新保持最新狀態?如何使用最新的Bootstrap版本和更新保持最新狀態?Mar 14, 2025 pm 07:40 PM

本文討論了保持自舉新版本,訪問官方文檔,最佳集成實踐以及社區資源討論的策略。

如何自定義Bootstrap組件的外觀和行為?如何自定義Bootstrap組件的外觀和行為?Mar 18, 2025 pm 01:06 PM

文章討論了使用CSS變量,SASS,自定義CSS,JavaScript和組件修改的自定義Bootstrap的外觀和行為。它還涵蓋了修改樣式和確保跨設備響應能力的最佳實踐。

Bootstrap框架(網格系統,版式,組件,實用程序)的關鍵組成部分是什麼?Bootstrap框架(網格系統,版式,組件,實用程序)的關鍵組成部分是什麼?Mar 14, 2025 pm 07:42 PM

文章討論了關鍵的引導組件:網格系統,版式,組件和實用程序。專注於增強響應式設計和交互式UI創建。

如何使用Bootstrap的網格系統為不同的屏幕尺寸創建響應式佈局?如何使用Bootstrap的網格系統為不同的屏幕尺寸創建響應式佈局?Mar 14, 2025 pm 07:43 PM

文章討論了使用Bootstrap的網格系統進行跨設備的響應佈局,詳細的結構,自定義和測試工具。

如何使Bootstrap網站訪問(A11Y)?如何使Bootstrap網站訪問(A11Y)?Mar 14, 2025 pm 07:36 PM

本文討論了通過使用語義HTML遵守WCAG標準來訪問Bootstrap網站,確保正確對比度,啟用鍵盤導航,實施ARIA和進行定期審核。

如何在不修改核心框架文件的情況下覆蓋Bootstrap的樣式?如何在不修改核心框架文件的情況下覆蓋Bootstrap的樣式?Mar 14, 2025 pm 07:44 PM

本文討論了使用自定義CSS覆蓋Bootstrap樣式的方法,專注於創建單獨的文件,使用特定性和組織的最佳實踐。

我如何為引導社區做出貢獻?我如何為引導社區做出貢獻?Mar 14, 2025 pm 07:38 PM

本文概述了為引導程序做出貢獻的方法,包括代碼提交,文檔改進,錯誤報告和社區參與。它提供了提交拉的請求和報告問題的詳細步驟。

在哪裡可以找到自舉模板和主題?在哪裡可以找到自舉模板和主題?Mar 14, 2025 pm 07:39 PM

本文討論了自由和高級的引導模板和主題的來源。它涵蓋了自定義,並列出了知名的下載網站。

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
3 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
3 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您聽不到任何人,如何修復音頻
3 週前By尊渡假赌尊渡假赌尊渡假赌

熱工具

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

將Eclipse與SAP NetWeaver應用伺服器整合。

Dreamweaver CS6

Dreamweaver CS6

視覺化網頁開發工具

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser是一個安全的瀏覽器環境,安全地進行線上考試。該軟體將任何電腦變成一個安全的工作站。它控制對任何實用工具的訪問,並防止學生使用未經授權的資源。

WebStorm Mac版

WebStorm Mac版

好用的JavaScript開發工具

SecLists

SecLists

SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。