Lecture 2
Lecture 2
- Bootstrap is a free front-end framework for faster and easier web development
- Bootstrap includes HTML and CSS based design templates for typography, forms,
buttons, tables, navigation, modals, image carousels and many other, as well as optional
JavaScript plugins
- Bootstrap also gives you the ability to easily create responsive designs
Bootstrap History
- Bootstrap was developed by Mark Otto and Jacob Thornton at Twitter, and released as
an open source product in August 2011 on GitHub.
- In June 2014 Bootstrap was the No.1 project on GitHub!
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)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
</head>
</html
2. Bootstrap 3 is mobile-first
- Bootstrap 3 is designed to be responsive to mobile devices. Mobile-first styles are part
of the core framework.
- To ensure proper rendering and touch zooming, add the following <meta> tag inside
the <head> element:
- The width=device-width part sets the width of the page to follow the screen-width of the
device (which will vary depending on the device).
- The initial-scale=1 part sets the initial zoom level when the page is first loaded by the
browser.
3. Containers
- Bootstrap also requires a containing element to wrap site contents.
Note: Containers are not nestable (you cannot put a container inside another container).
Installing Bootstrap
- To install the customized bootstrap, just copy the following folders(bootstrap CSS and
JavaScript) under C:\xampp\htdocs\websitefolder
- data
- dist
- js
- less
- vendor
2. MetisMenu CSS
vendor/metisMenu/metisMenu.min.css
4. Customized CSS
dist/css/customized.css
5. Customized Fonts
vendor/font-awesome/css/font-awesome.min.css
Note: All this CSS files must be link after the </title> tag.
Example:
1. Jquery Library
vendor/jquery/jquery.min.js
Note: All this CSS files must be link after the </body> tag.
Example:
<script src="vendor/jquery/jquery.min.js"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="vendor/metisMenu/metisMenu.min.js"></script>
<script src="dist/js/customized.js"></script>
sm (for tablets)
md (for desktops)
Note:
- First; create a row (<div class="row">). Then, add the desired number of columns (tags with
appropriate .col-*-* classes).
- Numbers in .col-*-* should always add up to 12 for each row.
Bootstrap Important Elements
Bootstrap Panels
- A panel in bootstrap is a bordered box with some padding around its content. It is looks like
a form in some Windows Applications.
Example:
<div class="panel panel-default">
<div class="panel-heading">Panel Heading</div>
<div class="panel-body">
Panel Body
</div>
<div class="panel-footer">Panel Footer</div>
</div>
Class Description
btn-primary Provides extra visual weight and identifies the primary action in a set of
buttons.
Example:
- <button type="button" class="btn btn-default">Default</button>
- <button type="button" class="btn btn-primary">Primary</button>
- <button type="button" class="btn btn-success">Success</button>
- <button type="button" class="btn btn-info">Info</button>
- <button type="button" class="btn btn-warning">Warning</button>
- <button type="button" class="btn btn-danger">Danger</button>
- <button type="button" class="btn btn-link">Link</button>
Disabled Buttons
- When you disable a button, it will fade in color by 50%, and lose the gradient.
- Add the disabled attribute to <button> buttons.
- btn-default disabled
- btn-primary disabled
- btn-success disabled
- btn-info disabled
- btn-warning disabled
- btn-danger disabled
- btn-link disabled
Example
- <button type="button" class="btn btn-default disabled">Default</button>
- <button type="button" class="btn btn-primary disabled">Primary</button>
- <button type="button" class="btn btn-success disabled">Success</button>
- <button type="button" class="btn btn-info disabled">Info</button>
- <button type="button" class="btn btn-warning disabled">Warning</button>
- <button type="button" class="btn btn-danger disabled">Danger</button>
- <button type="button" class="btn btn-link disabled">Link</button>
Button Sizes
Class Description
.btn-block This creates block level buttons—those that span the full width of a
parent.
Example:
- <button type="button" class="btn btn-primary btn-lg">Large button</button>
- <button type="button" class="btn btn-primary btn-sm">Small button</button>
- <button type="button" class="btn btn-primary btn-xs">Mini button</button>
- <button type="button" class="btn btn-primary btn-block">Block Level button</button>
Outline Buttons Class
- Just include btn-outline class of a button
Example:
<button type="button" class="btn btn-outline btn-default">Default</button>
<button type="button" class="btn btn-outline btn-primary">Primary</button>
<button type="button" class="btn btn-outline btn-success">Success</button>
<button type="button" class="btn btn-outline btn-info">Info</button>
<button type="button" class="btn btn-outline btn-warning">Warning</button>
<button type="button" class="btn btn-outline btn-danger">Danger</button>
<button type="button" class="btn btn-outline btn-link">Link</button>
Circle Button
- btn-circle class will make the button circular in shape.
Example:
Example:
Social Buttons
- btn-social class is usually used to link to the different Social Networking sites like
Facebook, Twitter and others.
Example:
<button type="button" class="btn btn-block btn-social btn-bitbucket"><i class="fa fa-bitbucket"></i> Sign in with
Bitbucket</button>
<button type="button" class="btn btn-block btn-social btn-dropbox"><i class="fa fa-dropbox"></i> Sign in with
Dropbox</button>
<button type="button" class="btn btn-block btn-social btn-facebook"><i class="fa fa-facebook"></i> Sign in with
Facebook</button>
<button type="button" class="btn btn-block btn-social btn-flickr"><i class="fa fa-flickr"></i> Sign in with Flickr</button>
<button type="button" class="btn btn-block btn-social btn-github"><i class="fa fa-github"></i> Sign in with
GitHub</button>
<button type="button" class="btn btn-block btn-social btn-google-plus"><i class="fa fa-google-plus"></i> Sign in with
Google</button>
<button type="button" class="btn btn-block btn-social btn-instagram"><i class="fa fa-instagram"></i> Sign in with
Instagram</button>
<button type="button" class="btn btn-block btn-social btn-linkedin"><i class="fa fa-linkedin"></i> Sign in with
LinkedIn</button>
<button type="button" class="btn btn-block btn-social btn-pinterest"><i class="fa fa-pinterest"></i> Sign in with Pinterest
</button>
<button type="button" class="btn btn-block btn-social btn-tumblr"><i class="fa fa-tumblr"></i> Sign in with Tumblr
</button>
<button type="button" class="btn btn-block btn-social btn-twitter"><i class="fa fa-twitter"></i> Sign in with Twitter
</button>
<button type="button" class="btn btn-block btn-social btn-vk"><i class="fa fa-vk"></i> Sign in with VK </button>