05 Bootstrap
05 Bootstrap
• Motivation of Bootstrap
• Where to Get Bootstrap
• Bootstrap Grid
• Bootstrap Elements
• Bootstrap Forms
WHAT IS RESPONSIVE WEB DESIGN?
Responsive Web Design makes your web page look good on all devices
(desktops, tablets, and phones).
Responsive Web Design is about using HTML and CSS to resize, hide,
shrink, enlarge, or move the content to make it look good on any screen.
WHAT IS BOOTSTRAP?
PRECOMPILED BOOTSTRAP
Once the compiled version Bootstrap is downloaded, extract the ZIP file, and you will see the
following file/directory structure:
As you can see there are compiled CSS and JS (bootstrap.*), as well as compiled and minified CSS and
JS (bootstrap.min.*). Fonts from Glyphicons are included, as is the optional Bootstrap theme.
ADVANTAGES OF BOOTSTRAP
Easy to use: Anybody with just basic knowledge of HTML and CSS can
start using Bootstrap
Responsive features: Bootstrap's responsive CSS adjusts to phones,
tablets, and desktops
Mobile-first approach: In Bootstrap 3, mobile-first styles are part of
the core framework
Browser compatibility: Bootstrap is compatible with all modern
browsers (Chrome, Firefox, Internet Explorer, Safari, and Opera)
WHERE TO GET BOOTSTRAP?
There are two ways to start using Bootstrap on your own web
site:
‒ Download Bootstrap from getbootstrap.com
‒ Include Bootstrap from a CDN
If you don't want to download and host Bootstrap yourself, you can include it from a CDN
(Content Delivery Network).
MaxCDN provides CDN support for Bootstrap's CSS and JavaScript. You must also include
jQuery
MAXCDN
Media query is a really fancy term for "conditional CSS rule". It simply applies some CSS based on
certain conditions set forth. If those conditions are met, the style is applied.
Media Queries in Bootstrap allow you to move, show and hide content based on viewport size. Following media
queries are used in LESS files to create the key breakpoints in the Bootstrap grid system.
GRID OPTIONS
The following
table summarizes
aspects of how
Bootstrap grid
system works
across multiple
devices:
GRID CLASSES
<div class="row">
<div class="col-*-*"></div>
<div class="col-*-*"></div>
</div>
<div class="row">
<div class="col-*-*"></div>
<div class="col-*-*"></div>
<div class="col-*-*"></div>
</div>
<div class="row">
...
</div>
Bootstrap Elements
BOOTSTRAP TABLES
Images come in all sizes. Responsive images automatically adjust to fit the
size of the screen.
Create responsive images by adding an .img-responsive class to the
<img> tag. The image will then scale nicely to the parent element.
The .img-responsive class applies display: block; and max-width: 100%; and
height: auto; to the image.
BOOTSTRAP ALERTS
Active/Disabled Buttons:
‒ The class .active makes a button appear pressed, and the class .disabled makes a button unclickable
Bootstrap Forms
FORM LAYOUT
<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>
FORM LAYOUT (CONT.)
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.
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.
• W3Schools
http://www.w3schools.com/bootstrap
• Tutorials Point
https://www.tutorialspoint.com/bootstrap/index.htm