乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      Bootstrap表單介紹

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

      - 垂直表單(默認)
      - 內(nèi)聯(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" href="http://apps./libs/bootstrap/3.3.0/css/bootstrap.min.css">
         <script src="http://apps./libs/jquery/2.1.1/jquery.min.js"></script>
         <script src="http://apps./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
      結果如下所示:
      

      這里寫圖片描述

      內(nèi)聯(lián)表單
      如果需要創(chuàng)建一個表單,它的所有元素是內(nèi)聯(lián)的,向左對齊的,標簽是并排的,請向 <form> 標簽添加 class .form-inline。
      
      <!DOCTYPE html>
      <html>
      <head>
         <title>Bootstrap 實例 - 內(nèi)聯(lián)表單</title>
         <link rel="stylesheet" href="http://apps./libs/bootstrap/3.3.0/css/bootstrap.min.css">
         <script src="http://apps./libs/jquery/2.1.1/jquery.min.js"></script>
         <script src="http://apps./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% 寬度。在使用內(nèi)聯(lián)表單時,您需要在表單控件上設置一個寬度。
      使用 class .sr-only,您可以隱藏內(nèi)聯(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" href="http://apps./libs/bootstrap/3.3.0/css/bootstrap.min.css">
         <script src="http://apps./libs/jquery/2.1.1/jquery.min.js"></script>
         <script src="http://apps./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)方法,下篇介紹表單支持的控件。
      

        本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內(nèi)容,請點擊一鍵舉報。
        轉藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約