{"id":3247,"date":"2017-12-21T08:19:17","date_gmt":"2017-12-21T13:19:17","guid":{"rendered":"https:\/\/www.pair.com\/support\/kb\/?p=3247"},"modified":"2020-02-26T09:20:54","modified_gmt":"2020-02-26T14:20:54","slug":"types-of-bootstrap-forms","status":"publish","type":"ht_kb","link":"https:\/\/www.pair.com\/support\/kb\/types-of-bootstrap-forms\/","title":{"rendered":"How to Customize Bootstrap Form Layouts"},"content":{"rendered":"<p><span style=\"font-weight: 400;\">Bootstrap has templates for many basic website components, such as forms. You can use these templates as a springboard into creating a custom form. Bootstrap also supplies preformatted form elements that you can easily swap in or out of your form. We\u2019ll go over the basics for customizing your\u00a0form's layout here. To see all of the available form templates and elements, see the <\/span><a href=\"https:\/\/getbootstrap.com\/docs\/4.2\/components\/forms\/#overview\"><b>Forms<\/b><span style=\"font-weight: 400;\"> section<\/span><\/a><span style=\"font-weight: 400;\"> of the Bootstrap CSS page.<\/span><\/p>\n    \t\t<div class=\"hts-messages hts-messages--info   hts-messages--withicon \"   >\r\n    \t\t\t    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\tThese instructions are for Bootstrap version\u00a04.2.1    \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n<p>If you are looking for instructions on how to add items to a Bootstrap form, see our <a href=\"https:\/\/www.pair.com\/support\/kb\/how-to-customize-your-bootstrap-form\/\" target=\"_blank\" rel=\"noopener noreferrer\">How to Add Items to a Bootstrap Form article<\/a>.<\/p>\n<h3>Form Customizations<\/h3>\n<p><span style=\"font-weight: 400;\">There are several types of form customizations: <a href=\"#form-groups\">groups<\/a>, <a href=\"#formControls\">controls<\/a>, <a href=\"#grids\">grids<\/a>, <a href=\"#row\">rows and columns<\/a>, <a href=\"#horizontal\">horizontal<\/a>,\u00a0 <a href=\"#auto\">auto-sizing<\/a>, and <a href=\"#inline\">inline<\/a>. Each will style your form in a different way. In some instances, you can use different types of customization within the same form.<\/span><br \/>\n<a name=\"form-group\"><\/a><\/p>\n<h4>Form Groups<\/h4>\n<p><span style=\"font-weight: 400;\">Using form-group classes in your form will automatically add spacing for labels and <a href=\"https:\/\/www.pair.com\/support\/kb\/how-to-customize-your-bootstrap-form\/#form-controls\" target=\"_blank\" rel=\"noopener noreferrer\">controls<\/a> (a type of form item).\u00a0<\/span><\/p>\n<p>You can add the form-group class to your form by encasing each label and<span style=\"font-weight: 400;\"><a href=\"https:\/\/www.pair.com\/support\/kb\/how-to-customize-your-bootstrap-form\/#form-controls\" target=\"_blank\" rel=\"noopener noreferrer\">\u00a0control\u00a0<\/a><\/span>in a div class with the form-group class:<\/p>\n<pre class=\"prettyprint\">&lt;div class =\"form-group\"&gt; &lt;!-- Bootstrap Label or Control code here --&gt; &lt;\/div&gt;<\/pre>\n<p><span style=\"font-weight: 400;\">Each form element and label needs to be in its own <\/span><span style=\"font-weight: 400; font-family: monospace;\">form-group<\/span><span style=\"font-weight: 400;\"> class. If they are not, the spacing style will not be applied. <\/span><\/p>\n<p>As you can see in the example below, the form that uses <span style=\"font-family: monospace;\">class=\"form-group\"<\/span> has applied spacing, while the form without <span style=\"font-family: monospace;\">class=\"form-group\"<\/span> doesn't apply much space between the form items.<a href=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/formgroup-image-1.png\" data-rel=\"lightbox-image-0\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-6599 aligncenter\" src=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/formgroup-image-1.png\" alt=\"formgroup image\" width=\"709\" height=\"666\" srcset=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/formgroup-image-1.png 709w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/formgroup-image-1-300x282.png 300w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/formgroup-image-1-50x47.png 50w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/formgroup-image-1-60x56.png 60w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/formgroup-image-1-100x94.png 100w\" sizes=\"(max-width: 709px) 100vw, 709px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400;\">In a large form, using the form-group class may be applied like this:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">&lt;form&gt; <\/span>\r\n<span style=\"font-weight: 400; color: #ff0000;\">&lt;div class=\u201dform-group\u201d&gt;<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0&lt;label for=\"example\"&gt;Email Address&lt;\/label&gt;<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0&lt;input type=\"email\" class=\"form-control\" placeholder=\"Enter your email\"&gt;<\/span>\r\n<span style=\"font-weight: 400; color: #ff0000;\">&lt;\/div&gt;\r\n\r\n&lt;div class=\u201dform-group\u201d&gt;<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0&lt;label for=\"example\"&gt;Password&lt;\/label&gt;<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0&lt;input type=\"password\" class=\"form-control\" placeholder=\"Enter your password\"&gt;<\/span>\r\n<span style=\"font-weight: 400; color: #ff0000;\">&lt;\/div&gt;<\/span>\r\n\r\n<span style=\"font-weight: 400;\">&lt;button type=\"submit\" class=\"btn btn-default\"&gt;Login&lt;\/button&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;\/form&gt;<\/span><\/pre>\n<p>The example above will show the automatic spacing of the <span style=\"font-family: monospace;\">form-group<\/span> class:<a href=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-group-4.png\" data-rel=\"lightbox-image-1\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-6611 aligncenter\" src=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-group-4.png\" alt=\"form group image\" width=\"644\" height=\"289\" srcset=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-group-4.png 644w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-group-4-300x135.png 300w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-group-4-50x22.png 50w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-group-4-60x27.png 60w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-group-4-100x45.png 100w\" sizes=\"(max-width: 644px) 100vw, 644px\" \/><\/a><br \/>\n<a name=\"formControl\"><\/a><\/p>\n<h4>Form Controls<\/h4>\n<p><span style=\"font-weight: 400;\">The <\/span><span style=\"font-weight: 400; font-family: monospace;\">form-control<\/span><span style=\"font-weight: 400;\"> class is different from the form-group class. While <\/span>form-group<span style=\"font-weight: 400;\"> sets up the spacing between form elements, <\/span>form-control <span style=\"font-weight: 400;\">sets the width of the form element to 100%, causing it to span the width of the form and resize with the window.\u00a0<\/span><\/p>\n<p><a name=\"formControlSelect\"><\/a><\/p>\n<h5>Form-Control in a Selection<\/h5>\n<p><span style=\"font-weight: 400;\">For example, if you wanted to add a selection form element with <\/span>form-control<span style=\"font-weight: 400;\">, the code would look like this:<\/span><\/p>\n<pre><span style=\"font-weight: 400;\">&lt;select <\/span><span style=\"font-weight: 400; color: #ff0000;\">class=\"form-control\"<\/span><span style=\"font-weight: 400;\">&gt;<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0&lt;option&gt;Option 1&lt;\/option&gt;<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0&lt;option&gt;Option 2&lt;\/option&gt;<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0&lt;option&gt;Option 3&lt;\/option&gt;<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0&lt;option&gt;Option 4&lt;\/option&gt;<\/span>\r\n<span style=\"font-weight: 400;\"> \u00a0&lt;option&gt;Option 5&lt;\/option&gt;<\/span>\r\n<span style=\"font-weight: 400;\">&lt;\/select&gt;<\/span><\/pre>\n<p>Below, you can see the difference between the code above with the form-control class and without the form-control class.<a href=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-control-1.png\" data-rel=\"lightbox-image-2\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-6598 aligncenter\" src=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-control-1.png\" alt=\"form control image\" width=\"623\" height=\"282\" srcset=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-control-1.png 623w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-control-1-300x136.png 300w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-control-1-50x23.png 50w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-control-1-60x27.png 60w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-control-1-100x45.png 100w\" sizes=\"(max-width: 623px) 100vw, 623px\" \/><\/a><br \/>\n<a name=\"grids\"><\/a><\/p>\n<h4>Form Grids<\/h4>\n<p><span style=\"font-weight: 400;\">You can use the <a href=\"https:\/\/www.pair.com\/support\/kb\/understanding-bootstraps-grid-system\/\" target=\"_blank\" rel=\"noopener noreferrer\">Bootstrap grid system<\/a> to organize your form. You can organize your <a href=\"https:\/\/www.pair.com\/support\/kb\/how-to-customize-your-bootstrap-form\/#form-controls\" target=\"_blank\" rel=\"noopener noreferrer\">form controls<\/a>\u00a0into columns and rows.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400;\">If you aren't familiar with the Bootstrap grid system, check out our article,\u00a0<a href=\"https:\/\/www.pair.com\/support\/kb\/understanding-bootstraps-grid-system\/\" target=\"_blank\" rel=\"noopener noreferrer\">Understanding Bootstrap's Grid System<\/a>.\u00a0<\/span><\/p>\n<p>You can add columns and rows by adding <span style=\"font-family: monospace;\">&lt;div class=\"row\"&gt;<\/span> and <span style=\"font-family: monospace;\">&lt;div class=\"col\"&gt;<\/span> to your form.<\/p>\n<p>Here's an example of how you can use rows and columns in form code:<\/p>\n<pre class=\"prettyprint\">&lt;form&gt; \r\n<span style=\"color: #ff0000;\">  &lt;div class=\"row\"&gt;<\/span>\r\n<span style=\"color: #ff0000;\">    &lt;div class=\"col\"&gt;<\/span>\r\n \u00a0    &lt;label for=\"exampleEmail\"&gt;Email Address&lt;\/label&gt;\r\n \u00a0    &lt;input type=\"email\" class=\"form-control\" placeholder=\"Enter your email\"&gt;\r\n    <span style=\"color: #ff0000;\">&lt;\/div&gt;<\/span>\r\n<span style=\"color: #ff0000;\">    &lt;div class=\"col\"&gt;<\/span>\r\n \u00a0    &lt;label for=\"examplePassword\"&gt;Password&lt;\/label&gt;\r\n \u00a0    &lt;input type=\"password\" class=\"form-control\" placeholder=\"Enter your password\"&gt;\r\n    <span style=\"color: #ff0000;\">&lt;\/div&gt;<\/span>\r\n<span style=\"color: #ff0000;\">  &lt;\/div&gt;<\/span>\r\n  &lt;div class=\"form-group\"&gt;\r\n      &lt;input type=\"checkbox\" class=\"form-check-input\" id=\"exampleCheckbox\"&gt;\r\n      &lt;label for=\"exampleCheckbox\"&gt;Sign me up to receive special promotions!&lt;\/label&gt;\r\n  &lt;\/div&gt;\r\n  &lt;button type=\"submit\" class=\"btn btn-primary\"&gt;Submit&lt;\/button&gt;\r\n&lt;\/form&gt;<\/pre>\n<p>In the example above, the email and password fields are separated into two columns within a row. This is why they are displayed side by side on a webpage. Because the checkbox is not in the row, it is placed beneath both the email and password fields. If another row came after this, it would also be placed underneath the previous section.<\/p>\n<p><a href=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/row-2.png\" data-rel=\"lightbox-image-3\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-6620\" src=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/row-2.png\" alt=\"row image\" width=\"783\" height=\"189\" srcset=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/row-2.png 783w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/row-2-300x72.png 300w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/row-2-768x185.png 768w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/row-2-50x12.png 50w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/row-2-60x14.png 60w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/row-2-100x24.png 100w\" sizes=\"(max-width: 783px) 100vw, 783px\" \/><\/a><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>The same rules that apply to <a href=\"https:\/\/www.pair.com\/support\/kb\/understanding-bootstraps-grid-system\/\" target=\"_blank\" rel=\"noopener noreferrer\">Bootstrap's grid system<\/a> apply to the grid forms. Keep in mind that columns go inside rows and that you can have up to twelve columns in a row.<\/p>\n<p>You can specify how many columns you want a form control to take up by using <span style=\"font-family: monospace;\">&lt;div class=\"col-prefix-#\"&gt;<\/span> instead of <span style=\"font-family: monospace;\">&lt;div class=\"col\"&gt;<\/span>. To learn more about column prefixes and numbers, see our <a href=\"https:\/\/www.pair.com\/support\/kb\/understanding-bootstraps-grid-system\/#columns-and-rows\" target=\"_blank\" rel=\"noopener noreferrer\">Bootstrap grid system article<\/a>.<\/p>\n<p><a name=\"row\"><\/a><\/p>\n<h4>Form Row<\/h4>\n<p>Like <a href=\"#grids\">form grids<\/a>, form rows use the same grid structure of columns and rows to style the form. However, using the form row class implements a tighter spacing style for columns within a row. So, instead of using <span style=\"font-family: monospace;\">&lt;div class=\"row\"&gt;<\/span>, you would use <span style=\"font-family: monospace;\">&lt;div class=\"form-row\"&gt;<\/span> in its place. The below code is an example of how the form-row class may be used:<\/p>\n<pre>&lt;form&gt; \r\n  <span style=\"color: #ff0000;\">&lt;div class=\"form-row\"&gt;<\/span>\r\n    &lt;div class=\"col\"&gt;\r\n\u00a0     &lt;label for=\"example\"&gt;Email Address&lt;\/label&gt;\r\n\u00a0     &lt;input type=\"email\" class=\"form-control\" placeholder=\"Enter your email\"&gt;\r\n    &lt;\/div&gt;\r\n    &lt;div class=\"col\"&gt;\r\n\u00a0     &lt;label for=\"example\"&gt;Password&lt;\/label&gt;\r\n\u00a0     &lt;input type=\"password\" class=\"form-control\" placeholder=\"Enter your password\"&gt;\r\n    &lt;\/div&gt;\r\n<span style=\"color: #ff0000;\">  &lt;\/div&gt;<\/span>\r\n  &lt;div class=\"form-group\"&gt;\r\n    &lt;div class=\"col\"&gt;\r\n     &lt;input type=\"checkbox\" class=\"form-check-input\" id=\"exampleCheckbox\"&gt;\r\n     &lt;label for=\"exampleCheckbox\"&gt;Sign me up to receive special promotions!&lt;\/label&gt;\r\n    &lt;\/div&gt;\r\n  &lt;\/div&gt;\r\n &lt;button type=\"submit\" class=\"btn btn-primary\"&gt;Submit&lt;\/button&gt;\r\n&lt;\/form&gt;<\/pre>\n<p>The above code is displayed with a smaller gap of space between the two columns:<\/p>\n<p><a href=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-row.png\" data-rel=\"lightbox-image-4\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-6618\" src=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-row.png\" alt=\"form row image\" width=\"759\" height=\"182\" srcset=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-row.png 759w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-row-300x72.png 300w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-row-50x12.png 50w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-row-60x14.png 60w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/form-row-100x24.png 100w\" sizes=\"(max-width: 759px) 100vw, 759px\" \/><\/a><\/p>\n<p>Now compare the above image (that uses the form-row class) to the image below (that uses just the row class). The amount of spacing between the two columns in the above image is smaller than the below image.<br \/>\n<a href=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/row-1.png\" data-rel=\"lightbox-image-5\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-6619\" src=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/row-1.png\" alt=\"row image\" width=\"783\" height=\"189\" srcset=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/row-1.png 783w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/row-1-300x72.png 300w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/row-1-768x185.png 768w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/row-1-50x12.png 50w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/row-1-60x14.png 60w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/row-1-100x24.png 100w\" sizes=\"(max-width: 783px) 100vw, 783px\" \/><\/a><\/p>\n<p><a name=\"auto\"><\/a><\/p>\n<h4>Form Auto-sizing<\/h4>\n<p>It is possible to set up forms that will automatically size themselves based on the form's content. While it still operates on a <a href=\"#grids\">grid<\/a>, all that is needed to implement an automatic sizing layout is to swap out the <span style=\"font-family: monospace;\">class=\"col\"<\/span> for <span style=\"font-family: monospace;\">class=\"col-auto\"<\/span><\/p>\n<p>For example, the code below uses auto-sizing class:<\/p>\n<pre>&lt;form&gt;\r\n  &lt;div class=\"row\"&gt;\r\n    &lt;label for=\"exampleEmail\" class=\"col-sm-2 col-form-label\"&gt;Email&lt;\/label&gt;\r\n      <span style=\"color: #ff0000;\">&lt;div class=\"col-auto\"&gt;<\/span>\r\n        &lt;input type=\"email\" class=\"form-control\" placeholder=\"Email\"&gt;\r\n      <span style=\"color: #ff0000;\">&lt;\/div&gt;<\/span>\r\n  &lt;\/div&gt;\r\n  &lt;div class=\"row\"&gt;\r\n     &lt;label for=\"examplePassword\" class=\"col-sm-2 col-form-label\"&gt;Password&lt;\/label&gt;\r\n       <span style=\"color: #ff0000;\">&lt;div class=\"col-auto\"&gt;<\/span>\r\n          &lt;input type=\"password\" class=\"form-control\" id=\"examplePassword\" placeholder=\"Password\"&gt;\r\n     <span style=\"color: #ff0000;\">  &lt;\/div&gt;<\/span>\r\n  &lt;\/div&gt;\r\n  &lt;div class=\"row\"&gt;\r\n   <span style=\"color: #ff0000;\"> &lt;div class=\"col-auto\"&gt;<\/span>\r\n      &lt;div class=\"form-check\"&gt;\r\n        &lt;input class=\"form-check-input\" type=\"checkbox\" id=\"exampleCheckbox\"&gt;\r\n        &lt;label class=\"form-check-label\" for=\"exampleCheckbox\"&gt;\r\n        Sign me up to receive special promotions!\r\n        &lt;\/label&gt;\r\n      <span style=\"color: #ff0000;\">&lt;\/div&gt;<\/span>\r\n    &lt;\/div&gt;\r\n  &lt;\/div&gt;\r\n  &lt;div class=\"row\"&gt;\r\n   <span style=\"color: #ff0000;\"> &lt;div class=\"col-auto\"&gt;<\/span>\r\n      &lt;button type=\"submit\" class=\"btn btn-primary\"&gt;Login&lt;\/button&gt;\r\n   <span style=\"color: #ff0000;\"> &lt;\/div&gt;<\/span>\r\n  &lt;\/div&gt;\r\n&lt;\/form&gt;<\/pre>\n<p>This will result in a form that automatically sizes itself based on the fields and labels:<\/p>\n<p><a href=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/auto.png\" data-rel=\"lightbox-image-6\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-6616 aligncenter\" src=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/auto.png\" alt=\"auto image\" width=\"667\" height=\"206\" srcset=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/auto.png 667w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/auto-300x93.png 300w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/auto-50x15.png 50w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/auto-60x19.png 60w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/auto-100x31.png 100w\" sizes=\"(max-width: 667px) 100vw, 667px\" \/><\/a><\/p>\n<p><a name=\"horizontal\"><\/a><\/p>\n<h4>Horizontal Form<\/h4>\n<p>The horizontal form uses a combination of <a href=\"#grids\">grid<\/a> and <a href=\"#form-group\">form grouping<\/a>. It uses both columns and rows, as well as the form-group class. The form will list labels and form controls horizontally, depending on the column layout.<\/p>\n<p>Here is an example of what the code for a horizontal form would be like:<\/p>\n<pre>&lt;form&gt;\r\n  <span style=\"color: #ff0000;\">&lt;div class=\"form-group row\"&gt;<\/span>\r\n     &lt;label for=\"exampleEmail\" class=\"col-sm-2 <span style=\"color: #0000ff;\">col-form-label<\/span>\"&gt;Email&lt;\/label&gt;\r\n       &lt;div class=\"col-sm-10\"&gt;\r\n         &lt;input type=\"email\" class=\"form-control\" placeholder=\"Email\"&gt;\r\n       &lt;\/div&gt;\r\n <span style=\"color: #ff0000;\"> &lt;\/div&gt;<\/span>\r\n  <span style=\"color: #ff0000;\">&lt;div class=\"form-group row\"&gt;<\/span>\r\n    &lt;label for=\"examplePassword\" class=\"col-sm-2 <span style=\"color: #0000ff;\">col-form-label<\/span>\"&gt;Password&lt;\/label&gt;\r\n       &lt;div class=\"col-sm-10\"&gt;\r\n         &lt;input type=\"password\" class=\"form-control\" id=\"examplePassword\" placeholder=\"Password\"&gt;\r\n       &lt;\/div&gt;\r\n<span style=\"color: #ff0000;\">  &lt;\/div&gt;<\/span>\r\n  <span style=\"color: #ff0000;\">&lt;div class=\"form-group row\"&gt;<\/span>\r\n    &lt;div class=\"col-sm-2\"&gt;&lt;\/div&gt;\r\n      &lt;div class=\"col-sm-10\"&gt;\r\n        &lt;div class=\"form-check\"&gt;\r\n          &lt;input class=\"form-check-input\" type=\"checkbox\" id=\"exampleCheckbox\"&gt;\r\n          &lt;label class=\"form-check-label\" for=\"exampleCheckbox\"&gt;\r\n          Sign me up to receive special promotions!\r\n          &lt;\/label&gt;\r\n        &lt;\/div&gt;\r\n      &lt;\/div&gt;\r\n  <span style=\"color: #ff0000;\">  &lt;\/div&gt;<\/span>\r\n  <span style=\"color: #ff0000;\">&lt;div class=\"form-group row\"&gt;<\/span>\r\n    &lt;div class=\"col-sm-10\"&gt;\r\n      &lt;button type=\"submit\" class=\"btn btn-primary\"&gt;Login&lt;\/button&gt;\r\n    &lt;\/div&gt;\r\n<span style=\"color: #ff0000;\">  &lt;\/div&gt;<\/span>\r\n&lt;\/form&gt;<\/pre>\n<p>The above code will align the labels and controls horizontally:<\/p>\n<p><a href=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/horizontal.png\" data-rel=\"lightbox-image-7\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img decoding=\"async\" loading=\"lazy\" class=\"size-full wp-image-6615 aligncenter\" src=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/horizontal.png\" alt=\"horizontal image\" width=\"689\" height=\"221\" srcset=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/horizontal.png 689w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/horizontal-300x96.png 300w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/horizontal-50x16.png 50w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/horizontal-60x19.png 60w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/horizontal-100x32.png 100w\" sizes=\"(max-width: 689px) 100vw, 689px\" \/><\/a><\/p>\n<p>With the horizontal form, it is important to include a special class with some control labels. This class is:<\/p>\n<pre>&lt;label class=\"col-sm-2 <span style=\"color: #0000ff;\">col-form-label<\/span>\"&gt;Password&lt;\/label&gt;<\/pre>\n<p>This class arranges the labels on the form, so forgetting it could result in strange label positions.<\/p>\n<p><a name=\"inline\"><\/a><\/p>\n<h4>Inline Forms<\/h4>\n<p>You can create an inline form by adding a <span style=\"font-family: monospace;\">form-inline<\/span> class to the &lt;form&gt; element at the beginning of your form. This will align controls and labels in the same row in a horizontal line.<\/p>\n<p>Here is an example of a form using the inline format:<\/p>\n<pre><span style=\"color: #ff0000;\">&lt;form class=\"form-inline\"&gt;<\/span>\r\n  &lt;label <span style=\"color: #0000ff;\"><span style=\"color: #000000;\">class=\"<\/span>my-1 mr-2\"<\/span> for=\"exampleEmail\"&gt;Email&lt;\/label&gt;\r\n  &lt;input type=\"text\" class=\"form-control <span style=\"color: #0000ff;\">mb-2 mr-sm-2<\/span>\" id=\"exampleEmail\" placeholder=\"email\"&gt;\r\n\r\n  &lt;label class=\"<span style=\"color: #0000ff;\">my-1 mr-2<\/span>\" for=\"examplePassword\"&gt;Password&lt;\/label&gt;\r\n  &lt;div class=\"input-group <span style=\"color: #0000ff;\">mb-2 mr-sm-2<\/span>\"&gt;\r\n    &lt;input type=\"text\" class=\"form-control\" id=\"examplePassword\" placeholder=\"password\"&gt;\r\n  &lt;\/div&gt;\r\n\r\n  &lt;div class=\"form-check <span style=\"color: #0000ff;\">mb-2 mr-sm-2<\/span>\"&gt;\r\n    &lt;input class=\"form-check-input\" type=\"checkbox\" id=\"inlineFormCheck\"&gt;\r\n    &lt;label class=\"form-check-label\" for=\"inlineFormCheck\"&gt;\r\n     Sign me up to receive special promotions!\r\n    &lt;\/label&gt;\r\n  &lt;\/div&gt;\r\n\r\n  &lt;button type=\"submit\" class=\"btn btn-primary <span style=\"color: #0000ff;\">mb-2<\/span>\"&gt;Submit&lt;\/button&gt;\r\n<span style=\"color: #ff0000;\">&lt;\/form&gt;<\/span><\/pre>\n<p>The above code will create a form that is displayed inline:<\/p>\n<p><a href=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/inline.png\" data-rel=\"lightbox-image-8\" data-rl_title=\"\" data-rl_caption=\"\" title=\"\"><img decoding=\"async\" loading=\"lazy\" class=\"alignleft size-full wp-image-6617\" src=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/inline.png\" alt=\"inline image\" width=\"996\" height=\"107\" srcset=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/inline.png 996w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/inline-300x32.png 300w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/inline-768x83.png 768w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/inline-50x5.png 50w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/inline-60x6.png 60w, https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/inline-100x11.png 100w\" sizes=\"(max-width: 996px) 100vw, 996px\" \/><\/a><\/p>\n<p>Notice that in this example, the labels and controls have different classes that we have not used in previous examples. These new classes are responsible for adding new spacing guidelines for this example. Inline forms can disturb the default spacing layout, so it may be necessary to use classes, like above.<\/p>\n<p>You can go to the <a href=\"https:\/\/getbootstrap.com\/docs\/4.0\/utilities\/spacing\/\" target=\"_blank\" rel=\"noopener noreferrer\">Bootstrap official documentation Spacing page<\/a> to find out more about these classes.<\/p>\n<p>If you want more information about Bootstrap forms, check out our <a href=\"https:\/\/www.pair.com\/support\/kb\/how-to-customize-your-bootstrap-form\/\" target=\"_blank\" rel=\"noopener noreferrer\">How to Add Items to a Bootstrap Form article<\/a>.<\/p>\n    \t\t<div class=\"hts-messages hts-messages--info    \"   >\r\n    \t\t\t    \t\t\t    \t\t\t\t<p>\r\n    \t\t\t\t\tBootstrap is an open-source CSS framework permissive under an MIT license. Bootstrap is not a product of Pair Networks, Inc., and Pair Networks provides no warranty for Bootstrap. Please note that there are many levels of CSS frameworks available. Please consult with your IT professional for advice and guidance on an appropriate CSS framework. This specific product may or may not meet your needs. Pair Networks, Inc. is providing support for this tutorial for your convenience and is not responsible for Bootstrap's performance. Please read carefully the terms and scope of services for any online service or product you are considering purchasing or using.    \t\t\t\t<\/p>\r\n    \t\t\t    \t\t\t\r\n    \t\t<\/div><!-- \/.ht-shortcodes-messages -->\r\n    \t\t\n","protected":false},"excerpt":{"rendered":"<p>Bootstrap has templates for many basic website components, such as forms. You can use these templates as a springboard into creating a custom form. Bootstrap also supplies preformatted form elements that you can easily swap in or out of your form. We\u2019ll go over the basics for customizing your\u00a0form&#8217;s layout&#8230;<\/p>\n","protected":false},"author":11,"comment_status":"closed","ping_status":"closed","template":"","format":"standard","meta":[],"ht-kb-category":[33],"ht-kb-tag":[187],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v21.8.1 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Customize Bootstrap Form Layouts - Knowledge Base - Pair Networks<\/title>\n<meta name=\"description\" content=\"Bootstrap has templates for many basic website components, such as forms. You can use these templates as a springboard into creating a custom form. Bootstrap also supplies preformatted form elements that you can easily swap in or out of your form. We\u2019ll go over the basics of Bootstrap form types here.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.pair.com\/support\/kb\/types-of-bootstrap-forms\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Customize Bootstrap Form Layouts - Knowledge Base - Pair Networks\" \/>\n<meta property=\"og:description\" content=\"Bootstrap has templates for many basic website components, such as forms. You can use these templates as a springboard into creating a custom form. Bootstrap also supplies preformatted form elements that you can easily swap in or out of your form. We\u2019ll go over the basics of Bootstrap form types here.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.pair.com\/support\/kb\/types-of-bootstrap-forms\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base - Pair Networks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pairnetworks\/\" \/>\n<meta property=\"article:modified_time\" content=\"2020-02-26T14:20:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/formgroup-image-1.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:site\" content=\"@pairNetworks\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"10 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/types-of-bootstrap-forms\/\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/types-of-bootstrap-forms\/\",\"name\":\"How to Customize Bootstrap Form Layouts - Knowledge Base - Pair Networks\",\"isPartOf\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#website\"},\"datePublished\":\"2017-12-21T13:19:17+00:00\",\"dateModified\":\"2020-02-26T14:20:54+00:00\",\"description\":\"Bootstrap has templates for many basic website components, such as forms. You can use these templates as a springboard into creating a custom form. Bootstrap also supplies preformatted form elements that you can easily swap in or out of your form. We\u2019ll go over the basics of Bootstrap form types here.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/types-of-bootstrap-forms\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.pair.com\/support\/kb\/types-of-bootstrap-forms\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/types-of-bootstrap-forms\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.pair.com\/support\/kb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Customize Bootstrap Form Layouts\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#website\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/\",\"name\":\"Knowledge Base - Pair Networks\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.pair.com\/support\/kb\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#organization\",\"name\":\"Pair Networks\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg\",\"contentUrl\":\"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg\",\"width\":360,\"height\":360,\"caption\":\"Pair Networks\"},\"image\":{\"@id\":\"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/pairnetworks\/\",\"https:\/\/twitter.com\/pairNetworks\",\"https:\/\/www.instagram.com\/pairnetworks\/\",\"https:\/\/www.linkedin.com\/company\/2269676\/\",\"https:\/\/www.pinterest.com\/pairnetworksinc\/pins\/\",\"https:\/\/www.youtube.com\/user\/pairnetworks\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Customize Bootstrap Form Layouts - Knowledge Base - Pair Networks","description":"Bootstrap has templates for many basic website components, such as forms. You can use these templates as a springboard into creating a custom form. Bootstrap also supplies preformatted form elements that you can easily swap in or out of your form. We\u2019ll go over the basics of Bootstrap form types here.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.pair.com\/support\/kb\/types-of-bootstrap-forms\/","og_locale":"en_US","og_type":"article","og_title":"How to Customize Bootstrap Form Layouts - Knowledge Base - Pair Networks","og_description":"Bootstrap has templates for many basic website components, such as forms. You can use these templates as a springboard into creating a custom form. Bootstrap also supplies preformatted form elements that you can easily swap in or out of your form. We\u2019ll go over the basics of Bootstrap form types here.","og_url":"https:\/\/www.pair.com\/support\/kb\/types-of-bootstrap-forms\/","og_site_name":"Knowledge Base - Pair Networks","article_publisher":"https:\/\/www.facebook.com\/pairnetworks\/","article_modified_time":"2020-02-26T14:20:54+00:00","og_image":[{"url":"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2019\/02\/formgroup-image-1.png"}],"twitter_card":"summary_large_image","twitter_site":"@pairNetworks","twitter_misc":{"Est. reading time":"10 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.pair.com\/support\/kb\/types-of-bootstrap-forms\/","url":"https:\/\/www.pair.com\/support\/kb\/types-of-bootstrap-forms\/","name":"How to Customize Bootstrap Form Layouts - Knowledge Base - Pair Networks","isPartOf":{"@id":"https:\/\/www.pair.com\/support\/kb\/#website"},"datePublished":"2017-12-21T13:19:17+00:00","dateModified":"2020-02-26T14:20:54+00:00","description":"Bootstrap has templates for many basic website components, such as forms. You can use these templates as a springboard into creating a custom form. Bootstrap also supplies preformatted form elements that you can easily swap in or out of your form. We\u2019ll go over the basics of Bootstrap form types here.","breadcrumb":{"@id":"https:\/\/www.pair.com\/support\/kb\/types-of-bootstrap-forms\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.pair.com\/support\/kb\/types-of-bootstrap-forms\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.pair.com\/support\/kb\/types-of-bootstrap-forms\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.pair.com\/support\/kb\/"},{"@type":"ListItem","position":2,"name":"How to Customize Bootstrap Form Layouts"}]},{"@type":"WebSite","@id":"https:\/\/www.pair.com\/support\/kb\/#website","url":"https:\/\/www.pair.com\/support\/kb\/","name":"Knowledge Base - Pair Networks","description":"","publisher":{"@id":"https:\/\/www.pair.com\/support\/kb\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.pair.com\/support\/kb\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.pair.com\/support\/kb\/#organization","name":"Pair Networks","url":"https:\/\/www.pair.com\/support\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg","contentUrl":"https:\/\/www.pair.com\/support\/kb\/wp-content\/uploads\/2022\/02\/Gb_TUkUE_400x400.jpeg","width":360,"height":360,"caption":"Pair Networks"},"image":{"@id":"https:\/\/www.pair.com\/support\/kb\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/pairnetworks\/","https:\/\/twitter.com\/pairNetworks","https:\/\/www.instagram.com\/pairnetworks\/","https:\/\/www.linkedin.com\/company\/2269676\/","https:\/\/www.pinterest.com\/pairnetworksinc\/pins\/","https:\/\/www.youtube.com\/user\/pairnetworks"]}]}},"_links":{"self":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/3247"}],"collection":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb"}],"about":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/types\/ht_kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/comments?post=3247"}],"version-history":[{"count":23,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/3247\/revisions"}],"predecessor-version":[{"id":7427,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb\/3247\/revisions\/7427"}],"wp:attachment":[{"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/media?parent=3247"}],"wp:term":[{"taxonomy":"ht_kb_category","embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb-category?post=3247"},{"taxonomy":"ht_kb_tag","embeddable":true,"href":"https:\/\/www.pair.com\/support\/kb\/wp-json\/wp\/v2\/ht-kb-tag?post=3247"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}