Bootstrap – Layout


Bootstrap – Form Layout



”;



This chapter will discuss about Bootstrap form layout. Add structure to your forms with form layout options, from inline to horizontal to implementing custom grids.


Form layout


  • Bootstrap gives no default styling for the <form> element, but there are a few capable browser highlights that are given by default. Each group of form fields must be inside a <form> element.

  • Ensure to be specify and include a type attribute for <button>s within a <form> as they default to type=”submit”.

  • Forms are stacked vertically by default. Bootstrap uses display: block and width: 100% to nearly all form controls. To change layout of each form, use additional classes.



Utilities

  • To add some structure to forms should be use margin utilities. Use basic grouping of labels, controls, optional form text, and form validation messages.

  • For consistency, sticking to margin-bottom utilities and employing a single direction all through the form is recommended.