bootstrap 水平排列表單__筆記

來源:互聯網
上載者:User
水平排列的表單

通過為表單添加 .form-horizontal 類,並聯合使用 Bootstrap 預置的柵格類,可以將 label 標籤和控制群組水平並排布局。這樣做將改變 .form-group 的行為,使其表現為柵格系統中的行(row),因此就無需再額外添加 .row 了。

水平表單與其他表單不僅標記的數量上不同,而且表單的呈現形式也不同。如需建立一個水平布局的表單,請按下面的幾個步驟進行:

向父 <form> 元素添加 class .form-horizontal。
把標籤和控制項放在一個帶有 class .form-group 的 <div> 中。
向標籤添加 class .control-label。

<form class="form-horizontal" role="form">   <div class="form-group">     <label for="inputEmail3" class="col-sm-2 control-label">Email</label>     <div class="col-sm-10">       <input type="email" class="form-control" id="inputEmail3" placeholder="Email">     </div>   </div>   <div class="form-group">     <label for="inputPassword3" class="col-sm-2 control-label">Password</label>     <div class="col-sm-10">       <input type="password" class="form-control" id="inputPassword3" placeholder="Password">     </div>   </div>   <div class="form-group">     <div class="col-sm-offset-2 col-sm-10">       <div class="checkbox">         <label>           <input type="checkbox"> Remember me         </label>       </div>     </div>   </div>   <div class="form-group">     <div class="col-sm-offset-2 col-sm-10">       <button type="submit" class="btn btn-default">Sign in</button>     </div>   </div> </form> 


聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.