添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Skip to main content

Layout

Give your forms some structure—from inline to horizontal to custom grid implementations—with our form layout options.

Forms

Every group of form fields should reside in a <Form> element. Bootstrap provides no default styling for the <Form> element, but there are some powerful browser features that are provided by default.

  • New to browser forms? Consider reviewing the MDN form docs for an overview and complete list of available attributes.
  • <button> s within a <Form> default to type="submit" , so strive to be specific and always include a type .
  • You can disable all controls within a form by wrapping them in a <fieldset> and setting the disabled attribute on it.
  • Since Bootstrap applies display: block and width: 100% to almost all our form controls, forms will by default stack vertically. Additional classes can be used to vary this layout on a per-form basis.

    Form groups

    The FormGroup component is the easiest way to add some structure to forms. It provides a flexible container for grouping of labels, controls, optional help text, and form validation messaging. Use it with fieldset s, div s, or nearly any other element.

    You also add the controlId prop to accessibly wire the nested label and input together via the id .

    Result
    Loading...
    Live Editor