-
Book Overview & Buying
-
Table Of Contents
Bootstrap for Rails
By :
Creating forms in Bootstrap is as easy as creating tables, which we have just seen in the previous section. All you need is some HTML markup and proper Bootstrap classes for forms. In this section, we will again create a dummy project called Bootstrap Forms and add an index.html file. Also, fill this file with the basic Bootstrap recommended HTML, as shown in the previous section. Do not forget to add the Bootstrap container in it.
Let's add a simple <form> tag to the preceding container:
<div class="container"> <form> </form> </div>
You don't have to attach any class to the form tag. The classes here are added to the form elements.
Let's add our first form element to our form. We will place a text field and an associated label element. Bootstrap allows you to create a form group which consists of a label and a text field. This helps Bootstrap to properly style the form elements. A form group is...
Change the font size
Change margin width
Change background colour