国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費電子書等14項超值服

開通VIP
Bootstrap表單介紹
Bootstrap來自 Twitter,是目前最受歡迎的前端框架。Bootstrap 是基于 HTML、CSS、JAVASCRIPT 的,它簡潔靈活,使得 Web 開發(fā)更加快捷。本文介紹一下Bootstrap的表單類型以及實現(xiàn)方法。Bootstrap 提供了下列類型的表單布局:

- 垂直表單(默認)
- 內聯(lián)表單
- 水平表單
- 垂直或基本表單

基本的表單結構是 Bootstrap 自帶的,個別的表單控件自動接收一些全局樣式。下面列出了創(chuàng)建基本表單的步驟:向父 <form> 元素添加 role="form"。把標簽和控件放在一個帶有 class .form-group 的 <div> 中。這是獲取最佳間距所必需的。向所有的文本元素 <input>、<textarea> 和 <select> 添加 class .form-control。
<!DOCTYPE html><html><head>   <title>Bootstrap 實例 - 基本表單</title>   <link rel="stylesheet" >   <script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>   <script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script></head><body><form role="form">   <div class="form-group">      <label for="name">名稱</label>      <input type="text" class="form-control" id="name"          placeholder="請輸入名稱">   </div>   <div class="form-group">      <label for="inputfile">文件輸入</label>      <input type="file" id="inputfile">      <p class="help-block">這里是塊級幫助文本的實例。</p>   </div>   <div class="checkbox">      <label>      <input type="checkbox"> 請打勾      </label>   </div>   <button type="submit" class="btn btn-default">提交</button></form></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
結果如下所示:

內聯(lián)表單如果需要創(chuàng)建一個表單,它的所有元素是內聯(lián)的,向左對齊的,標簽是并排的,請向 <form> 標簽添加 class .form-inline。
<!DOCTYPE html><html><head>   <title>Bootstrap 實例 - 內聯(lián)表單</title>   <link rel="stylesheet" >   <script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>   <script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script></head><body><form class="form-inline" role="form">   <div class="form-group">      <label class="sr-only" for="name">名稱</label>      <input type="text" class="form-control" id="name"          placeholder="請輸入名稱">   </div>   <div class="form-group">      <label class="sr-only" for="inputfile">文件輸入</label>      <input type="file" id="inputfile">   </div>   <div class="checkbox">      <label>      <input type="checkbox"> 請打勾      </label>   </div>   <button type="submit" class="btn btn-default">提交</button></form></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
結果如下所示:

默認情況下,Bootstrap 中的 input、select 和 textarea 有 100% 寬度。在使用內聯(lián)表單時,您需要在表單控件上設置一個寬度。使用 class .sr-only,您可以隱藏內聯(lián)表單的標簽。水平表單水平表單與其他表單不僅標記的數(shù)量上不同,而且表單的呈現(xiàn)形式也不同。如需創(chuàng)建一個水平布局的表單,請按下面的幾個步驟進行:向父 <form> 元素添加 class .form-horizontal。把標簽和控件放在一個帶有 class .form-group 的 <div> 中。向標簽添加 class .control-label。
<!DOCTYPE html><html><head>   <title>Bootstrap 實例 - 水平表單</title>   <link rel="stylesheet" >   <script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>   <script src="http://apps.bdimg.com/libs/bootstrap/3.3.0/js/bootstrap.min.js"></script></head><body><form class="form-horizontal" role="form">   <div class="form-group">      <label for="firstname" class="col-sm-2 control-label">名字</label>      <div class="col-sm-10">         <input type="text" class="form-control" id="firstname"             placeholder="請輸入名字">      </div>   </div>   <div class="form-group">      <label for="lastname" class="col-sm-2 control-label">姓</label>      <div class="col-sm-10">         <input type="text" class="form-control" id="lastname"             placeholder="請輸入姓">      </div>   </div>   <div class="form-group">      <div class="col-sm-offset-2 col-sm-10">         <div class="checkbox">            <label>               <input type="checkbox"> 請記住我            </label>         </div>      </div>   </div>   <div class="form-group">      <div class="col-sm-offset-2 col-sm-10">         <button type="submit" class="btn btn-default">登錄</button>      </div>   </div></form></body></html>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
結果如下所示:

本文介紹了Bootstrap的表單類型和實現(xiàn)方法,下篇介紹表單支持的控件。
本站僅提供存儲服務,所有內容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權內容,請點擊舉報。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
將展示內容(div、iframe)放在Expand控件中
Bootstrap
bootstrap4 textarea
bootstrap+jQuery.validate表單校驗
python測試開發(fā)django -143.Bootstrap 表單控件校驗狀態(tài)
(雙日歷)bootstrap-daterangepicker
更多類似文章 >>
生活服務
分享 收藏 導長圖 關注 下載文章
綁定賬號成功
后續(xù)可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點擊這里聯(lián)系客服!

聯(lián)系客服