Booststrap Intro
Booststrap Intro
I
SYNOPSIS
CSS Overview
Typography
Tables
Forms
Buttons
Images
Helper Class
CSS Overview
HTML5 doctype:
Bootstrap makes use of certain HTML elements and
CSS properties that require the use of the HTML5 doctype.
Hence include the below piece of code for HTML5 doctype at
the beginning of all your projects using Bootstrap.
<!DOCTYPE html>
<html>
....
</html>
Responsive images
Bootstrap 3 allows to make the images responsive by
adding a class .img-responsive to the <img>tag. This class
applies max-width: 100%; and height: auto; to the image so
that it scales nicely to the parent element.
<img src="..." class="img-responsive" alt="Responsive image">
Images
Bootstrap provides three classes that can be used to
apply some simple styles to images:
OUTPUT:
Containers:
Use class .container to wrap a page's content and easily center the
content's as shown below.
<div class="container"> ... </div>
Take a look at the .container class in bootstrap.css file:
.container {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
Note that, due to padding and fixed widths, containers are not nestable by default.
Take a look at bootstrap.css file:
@media (min-width: 768px) {
.container {
width: 750px;
}
Typography
Bootstrap uses Helvetica Neue, Helvetica, Arial, and sans-serif
in its default font stack. Using typography feature of Bootstrap
you can create headings, paragraphs, lists and other inline
elements.
Headings:
All HTML headings (h1 to h6) are styled in Bootstrap. An
example is as shown below:
<h1>I'm Heading1 h1</h1>
<h2>I'm Heading2 h2</h2>
<h3>I'm Heading3 h3</h3>
<h4>I'm Heading4 h4</h4>
<h5>I'm Heading5 h5</h5>
<h6>I'm Heading6 h6</h6>
Typography
INLINE SUBHEADINGS:
To add an inline subheading to any of the headings, simply add
<small> around any of the elements or add .small class and you will get
smaller text in a lighter color as shown in the example below:
<table class="table">
<caption>Basic Table Layout</caption>
.
.
.
</table>
Tables
STRIPED TABLE :
By adding the .table-striped class, you will get stripes on
rows within the <tbody> as seen in the following example:
<div class="table-responsive">
<table class="table">
<caption>Responsive Table Layout</caption>
.
.
.
</table>
</div>
Forms
Here we will discuss, how to create forms with ease
using Bootstrap.
Form Layout:
Bootstrap provides you with following types of form
layouts:
Vertical (default) form
Inline form
Horizontal form
Forms
VERTICAL OR BASIC FORM:
Add a role form to the parent <form> element.
Wrap labels and controls in a <div> with class .form-group. This is
needed for optimum spacing.
Add a class of .form-control to all textual <input>, <textarea>,
and <select> elements.
<form role="form">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name"
placeholder="Enter Name">
</div>
</form>
Forms
VERTICAL OR BASIC FORM:
Add a role form to the parent <form> element.
Wrap labels and controls in a <div> with class .form-group.
This is needed for optimum spacing.
Add a class of .form-control to all textual <input>,
<textarea>, and <select> elements.
<form role="form">
<div class="form-group">
<label for="name">Name</label>
<input type="text" class="form-control" id="name"
placeholder="Enter Name">
</div>
</form>
Forms
INLINE FORM :
To create a form where all of the elements are
inline, left aligned and labels are alongside, add the
class .forminline to the <form> tag.
<form class="form-inline" role="form">
<div class="form-group">
<label class="sr-only" for="name">Name</label>
<input type="text" class="form-control" id="name"
placeholder="Enter Name">
</div>
</form>
Forms
HORIZONTAL FORM:
Add a class of .form-horizontal to the parent <form> element.
Wrap labels and controls in a <div> with class .form-group.
Add a class of .control-label to the labels.
OUTPUT:
Helper Classes
Close icon :
Use the generic close icon for dismissing content like modals and
alerts. Use the class close to get the close icon.
Carets:
Use carets to indicate dropdown functionality and direction. To get
this functionality use the class caretwith a <span> element.
Thank You.