Bootstrap forms, do you know them? Our new article is for beginners and will show the process of creating pages using the bootstrap. Also we will tell you what is bootstrap, its purpose, installing, and the process of designing forms.
GETTING START WITH BOOTSTRAP FORMS
Content
- What is bootstrap
- Components of bootstrap
- Importance of bootstrap
- Downloading bootstrap
- Bootstrapping a form
- Download resources
INTRODUCTION
WHAT IS BOOTSTRAP
The BOOTSTRAP official website is being updated at interval and it includes a clear definition for now which states that “Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web.” It is an html, css, javascript framework that you can use as basis for creating web sites or web applications.
COMPONENTS OF BOOTSTRAP
From the definition given to BOOTSTRAP above you and I have seen that bootstrap is no other thing than a web kit that assist web designers and developers in achieving an appealing aesthetic outlook in their day to day web projects
From the image above notice that officially bootstrap file structure or organisation contains below listed
- CSS – encompasses of .css file frameworks
- FONTS – glyph-icons (icon fonts)
- JS – comprises of jQuery and Javascript files
IMPORTANCE OF BOOTSTRAP
Easy to use
Even if you are not an expert web designer or developer bootstrap get you covered to achieving that beautiful Responsive web outlook you desire. Learn to how design an aesthetic website interface / outlook easy and simple in our next tutorials using bootstrap
Optimisation
They load fast because of their small file size and thorough compressed jQuery, CSS and Javascript files since it maintains consistency to design and code between projects and between developers
Supports
They’re supported in all browsers (even back to IE6). It Ensure cross-browser compatibility
DOWNLOADING BOOTSTRAP
Getting started: Go to bootstrap official website and the bootstrap zip file and unzip it in any directory of your choice and remember the file organisation it is importance for protocols.
BOOTSTRAPPING A FORM
GETTING STARTED WITH BOOTSTRAP FORM
Now let’s create a responsive form using bootstraps
- Create a folder named ‘forms‘
- Create another folder named ‘assets‘
in the ‘forms‘Open that folder and create two .css files respectively app.css and style.css
i. app.css
copy and paste the following below codes in the app.css file
035 |
font-family : "Open Sans" , Arial , sans-serif ; |
037 |
h 1 , h 2 , h 3 , h 4 , h 5 , h 6 { |
042 |
font-family : "Open Sans" , Arial , sans-serif ; |
044 |
h 1 i, h 2 i, h 3 i, h 4 i, h 5 i, h 6 i { |
049 |
.devider.devider- dotted { |
050 |
border-top : 2px dotted #eee ; |
052 |
.devider.devider- dashed { |
053 |
border-top : 2px dashed #eee ; |
055 |
.devider.devider-db { |
057 |
border-top : 1px solid #eee ; |
058 |
border-bottom : 1px solid #eee ; |
060 |
.devider.devider-db- dashed { |
062 |
border-top : 1px dashed #ddd ; |
063 |
border-bottom : 1px dashed #ddd ; |
065 |
.devider.devider-db- dotted { |
067 |
border-top : 1px dotted #ddd ; |
068 |
border-bottom : 1px dotted #ddd ; |
073 |
.table thead > tr > th { |
076 |
@media ( max-width : 768px ) { |
078 |
.table td.hidden-sm { |
079 |
display : none !important ; |
091 |
.form-control:focus { |
093 |
box-shadow: 0 0 2px #c9c9c9 ; |
096 |
.form-spacing .form-control { |
121 |
display : inline- block ; |
122 |
text-decoration : none ; |
126 |
text-decoration : none ; |
127 |
transition: all 0.3 s ease-in-out; |
133 |
.btn-group .dropdown-menu > li > a { |
137 |
.btn-group-vertical > .btn-u { |
141 |
.btn-group > .btn-u:first-child { |
145 |
@-moz-document url-prefix() { |
146 |
.footer-subscribe .btn-u { |
150 |
@media ( max-width : 768px ) { |
151 |
@-moz-document url-prefix() { |
162 |
.open .dropdown-toggle.btn-u { |
165 |
.btn-u-split.dropdown-toggle { |
166 |
border-left : solid 1px #5fb611 ; |
171 |
.btn-u.btn-u-blue:hover, |
172 |
.btn-u.btn-u-blue:focus, |
173 |
.btn-u.btn-u-blue:active, |
174 |
.btn-u.btn-u- blue .active, |
175 |
.open .dropdown-toggle.btn-u.btn-u- blue { |
178 |
.btn-u.btn-u-split- blue .dropdown-toggle { |
179 |
border-left : solid 1px #2980b9 ; |
184 |
.btn-u.btn-u-green:hover, |
185 |
.btn-u.btn-u-green:focus, |
186 |
.btn-u.btn-u-green:active, |
187 |
.btn-u.btn-u- green .active, |
188 |
.open .dropdown-toggle.btn-u.btn-u- green { |
191 |
.btn-u.btn-u-split- green .dropdown-toggle { |
192 |
border-left : solid 1px #2ecc71 ; |
194 |
.btn-u.btn-u- default { |
197 |
.btn-u.btn-u-default:hover, |
198 |
.btn-u.btn-u-default:focus, |
199 |
.btn-u.btn-u-default:active, |
200 |
.btn-u.btn-u- default .active, |
201 |
.open .dropdown-toggle.btn-u.btn-u- default { |
204 |
.btn-u.btn-u-split- default .dropdown-toggle { |
205 |
border-left : solid 1px #7f8c8d ; |
212 |
border : solid 1px transparent ; |
214 |
.btn-u.btn-brd-width -2 { |
218 |
.btn-u.btn-brd:hover { |
221 |
.btn-u.btn-brd:focus { |
224 |
.btn-u.btn-brd.btn-brd-hover:hover { |
225 |
color : #fff !important ; |
228 |
border-color : #00d2ff ; |
230 |
.btn-u.btn-brd:hover { |
232 |
border-color : #5fb611 ; |
234 |
.btn-u.btn-brd.btn-brd-hover:hover { |
237 |
.btn-u.btn-brd.btn-u- default { |
238 |
border-color : #95a5a6 ; |
240 |
.btn-u.btn-brd.btn-u-default:hover { |
242 |
border-color : #7f8c8d ; |
244 |
.btn-u.btn-brd.btn-u- default .btn-brd-hover:hover { |
265 |
display : inline- block ; |
266 |
border : solid 1px #555 ; |
278 |
.fa- fixed [class^= "fa" ], |
279 |
.fa- fixed [class*= " fa" ] { |
282 |
display : inline- block ; |
288 |
.panel-group .panel { |
301 |
border-color : #00d2ff ; |
303 |
.panel-u > .panel-heading { |
308 |
border-color : #3498db ; |
310 |
.panel- blue > .panel-heading { |
315 |
border-color : #e74c3c ; |
317 |
.panel- red > .panel-heading { |
322 |
border-color : #2ecc71 ; |
324 |
.panel- green > .panel-heading { |
329 |
border-color : #1abc9c ; |
331 |
.panel-sea > .panel-heading { |
336 |
border-color : #e67e22 ; |
338 |
.panel-orange > .panel-heading { |
343 |
border-color : #95a5a6 ; |
345 |
.panel-grey > .panel-heading { |
350 |
border-color : #9c8061 ; |
352 |
.panel-brown > .panel-heading { |
357 |
border-color : #4765a0 ; |
359 |
.panel-dark- blue > .panel-heading { |
364 |
border-color : #79d5b3 ; |
366 |
.panel-light- green > .panel-heading { |
370 |
.panel-default-dark { |
371 |
border-color : #585f69 ; |
373 |
.panel-default-dark > .panel-heading { |
ii. style.css
copy and paste the following code in style.css
25 |
text-decoration : none ; |
33 |
outline : 0 !important ; |
36 |
text-decoration : none ; |
40 |
text-decoration : underline ; |
- Copy the downloaded unzipped bootstrap file into the directly called ‘forms‘
Now lets start the real bootstrapping
Firstly we ought to know that bootstrap have three standard form interface or layout namely
- Basic form interface
- Horizontal form interface
- Inline form interface
Create three different files in the folder ‘forms’ and name them accordingly in respect to the standard bootstrap form interface listed above
copy and paste the following basic html structure snippet of code in each
04 |
< title >Common Form Components | Script-Tutorials - Responsive Website Template</ title > |
06 |
< meta charset = "utf-8" > |
07 |
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" > |
08 |
< meta name = "description" content = "script-tutorials on bootstrap forms" > |
09 |
< meta name = "author" content = "Okeagu Godwin" > |
11 |
< link rel = "shortcut icon" href = "favicon.ico" > |
13 |
< link rel = "stylesheet" href = "//fonts.googleapis.com/css?family=Open+Sans:600,400,300&subset=cyrillic,latin" > |
15 |
< link rel = "stylesheet" href = "bootstrap/css/bootstrap.min.css" > |
17 |
< link rel = "stylesheet" href = "assets/style.css" > |
19 |
< link rel = "stylesheet" href = "assets/plugins/font-awesome/css/font-awesome.min.css" > |
23 |
< div class = "col-md-9" > |
30 |
< script type = "text/javascript" src = "bootstrap/js/bootstrap.min.js" ></ script > |
Observations:
-
2 |
< link rel = "stylesheet" href = "bootstrap/css/bootstrap.min.css" > |
-
2 |
< link rel = "stylesheet" href = "assets/style.css" > |
div class="wrapper"
div class="col-md-9"
The bootstrap css file was linked to the html just like description in the preceding list above numbered 1.
While a custom stylesheet file was also link in order to add more aesthetics to the form.
The first div class was defined wrapper for consistency among web-designers it was to style in the bootstrap to fit any screen and house all other site content in the body tag <body> --- </body>
The second div class was defined col-md-9
to create / invoke already style responsive bootstrap column in the wrapper that will house the form content specifically.
Note
Copy and paste the codes of the standard bootstrap standard form interface in between the comment above in the basic html structure snippet of code give above
1 |
<!—form content begins---> |
Basic Bootstrap form interface
Notice the form class="margin-bottom-40"
or the class might either remain undefined
Basic Bootstrap form Html code
02 |
< div class = "panel panel-blue margin-bottom-40" > |
03 |
< div class = "panel-heading" > |
04 |
< h3 class = "panel-title" >< i class = "fa fa-tasks" ></ i > Basic Form</ h3 > |
06 |
< div class = "panel-body" > |
07 |
< form class = "margin-bottom-40" role = "form" > |
08 |
< div class = "form-group" > |
09 |
< label for = "exampleInputEmail1" >Email address</ label > |
10 |
< input class = "form-control" id = "exampleInputEmail1" placeholder = "Enter email" type = "email" > |
12 |
< div class = "form-group" > |
13 |
< label for = "exampleInputPassword1" >Password</ label > |
14 |
< input class = "form-control" id = "exampleInputPassword1" placeholder = "Password" type = "password" > |
16 |
< div class = "checkbox" > |
18 |
< input type = "checkbox" > Check me out |
21 |
< button type = "submit" class = "btn-u btn-u-blue" >Submit</ button > |
Bootstrap Horizontal form interface
Notice: form class="form-horizontal"
the form class name is defined horizontally so the form take a horizontal form interface
Html code Bootstrap Horizontal form
02 |
< div class = "panel panel-green margin-bottom-40" > |
03 |
< div class = "panel-heading" > |
04 |
< h3 class = "panel-title" >< i class = "fa fa-tasks" ></ i > Horizontal Form</ h3 > |
06 |
< div class = "panel-body" > |
07 |
< form class = "form-horizontal" role = "form" > |
08 |
< div class = "form-group" > |
09 |
< label for = "inputEmail1" class = "col-lg-2 control-label" >Email</ label > |
10 |
< div class = "col-lg-10" > |
11 |
< input class = "form-control" id = "inputEmail1" placeholder = "Email" type = "email" > |
14 |
< div class = "form-group" > |
15 |
< label for = "inputPassword1" class = "col-lg-2 control-label" >Password</ label > |
16 |
< div class = "col-lg-10" > |
17 |
< input class = "form-control" id = "inputPassword1" placeholder = "Password" type = "password" > |
20 |
< div class = "form-group" > |
21 |
< div class = "col-lg-offset-2 col-lg-10" > |
22 |
< div class = "checkbox" > |
24 |
< input type = "checkbox" > Remember me |
29 |
< div class = "form-group" > |
30 |
< div class = "col-lg-offset-2 col-lg-10" > |
31 |
< button type = "submit" class = "btn-u btn-u-green" >Sign in</ button > |
Bootstrap inline form interface
Notice that the form class="form-inline"
so the form take the inline interface layout
Html code for Bootstrap inline form
02 |
< div class = "panel panel-grey margin-bottom-40" > |
03 |
< div class = "panel-heading" > |
04 |
< h3 class = "panel-title" >< i class = "fa fa-tasks" ></ i > Inline Form</ h3 > |
06 |
< div class = "panel-body" > |
07 |
< form class = "form-inline" role = "form" > |
08 |
< div class = "form-group" > |
09 |
< label class = "sr-only" for = "exampleInputEmail2" >Email address</ label > |
10 |
< input class = "form-control" id = "exampleInputEmail2" placeholder = "Enter email" type = "email" > |
12 |
< div class = "form-group" > |
13 |
< label class = "sr-only" for = "exampleInputPassword2" >Password</ label > |
14 |
< input class = "form-control" id = "exampleInputPassword2" placeholder = "Password" type = "password" > |
16 |
< div class = "checkbox" > |
18 |
< input type = "checkbox" > Remember me |
21 |
< button type = "submit" class = "btn-u btn-u-default" >Sign in</ button > |
[sociallocker]
[/sociallocker]