Book Image

Bootstrap for Rails

By : Syed F Rahman
Book Image

Bootstrap for Rails

By: Syed F Rahman

Overview of this book

Table of Contents (18 chapters)
Bootstrap for Rails
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Creating Bootstrap forms


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 created using a div element...