Bootstrap _javascript tips for achieving horizontal arrangement of forms

Source: Internet
Author: User
Tags button type

By adding the. Form-horizontal class to the form and combining the grid classes with the Bootstrap preset, you can lay out the label label and the group of controls side by level. Doing so will change the behavior of the. Form-group so that it behaves as a row in a grid system, so there is no need to add additional. Row.

A horizontal form differs from the number of other forms that are not labeled, and forms are rendered differently. To create a form that is horizontally laid out, follow these steps:

1. Add Class. Form-horizontal to the parent <form> element.
2. Put the labels and controls in a <div> with class. Form-group.
3, add class to the label. Control-label.

Implementation code:

<form class= "form-horizontal" role= "form" > <div class= "Form-group" > <label for= "inputEmail3" class= "C" Ol-sm-2 Control-label ">Email</label> <div class=" col-sm-10 "> <input type=" Email "class=" Form-cont  Rol "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" > <in Put type= "password" class= "Form-control" id= "inputPassword3" placeholder= "password" > </div> </div> & Lt;div class= "Form-group" > <div class= "col-sm-offset-2 col-sm-10" > <div class= "checkbox" > <l abel> <input type= "checkbox" > Remember me </label> </div> </div> &LT;/DIV&G 
 T <div class= "Form-group" > <div class= "col-sm-offset-2 col-sm-10" > <button type= "Submit" class= "Btn BT N-default ">signin</button> </div> </div> </form>  

If you want to further study, you can click here to learn, and then attach a wonderful topic: Bootstrap Learning Course

The above is the entire content of this article, I hope to help you learn, but also hope that we support the cloud habitat community.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.