Unit - 2 - 2 Bootstrap
Unit - 2 - 2 Bootstrap
➢ Bootstrap is the popular HTML, CSS and JavaScript framework for developing a responsive
and mobile friendly website.
➢ It includes HTML and CSS based design templates for typography, forms, buttons, tables,
navigation, modals, image carousels and many others.
➢ Bootstrap is more than efficient to create a responsive and mobile first website but it is not
the best in the industry. There is an alternative of Bootstrap named W3.CSS which is smaller,
faster, and easier to use.
[email protected] 2
Advantages of Bootstrap
[email protected] 3
Contents of Bootstrap Package
➢ Scaffolding: Bootstrap provides a basic structure with Grid System, link styles, and background.
➢ CSS: Bootstrap comes with the feature of global CSS settings, fundamental HTML elements style
and an advanced grid system.
➢ JavaScript Plugins: Bootstrap also contains a lot of custom jQuery plugins. You can easily include
them all, or one by one.
➢ Customize: Bootstrap components are customizable and you can customize Bootstrap's
components, LESS variables, and jQuery plugins to get your own style.
[email protected] 4
Why Bootstrap?
➢ Mobile first approach − Bootstrap 3, framework consists of Mobile first styles throughout the
entire library instead them of in separate files.
➢ Easy to get started − With just the knowledge of HTML and CSS anyone can get started with
Bootstrap. Also the Bootstrap official site has a good documentation.
➢ Responsive design − Bootstrap's responsive CSS adjusts to Desktops, Tablets and Mobiles. More
about the responsive design is in the chapter Bootstrap Responsive Design.
➢ Provides a clean and uniform solution for building an interface for developers.
➢ It contains beautiful and functional built-in components which are easy to customize.
[email protected] 6
Example
[email protected] 7
Container
➢In Bootstrap, container is used to set the content's margins dealing with
the responsive behaviors of your layout.
➢It contains the row elements and the row elements are the container of
columns (known as grid system).
➢The container class is used to create boxed content.
➢There are two container classes in Bootstrap:
1. container
2. container-fluid
[email protected] 8
Container Structure
[email protected] 9
Container Example
[email protected] 10
Buttons
➢ There are seven styles to add a button in Bootstrap.
[email protected] 12
Button Size Example
[email protected] 13
Button Enable-Disable Example
[email protected] 14
Button Outline / Bordered Buttons
[email protected] 15
Grid System
[email protected] 16
Mobile First Strategy
• Content
• Determine what is most important.
• Layout
• Design to smaller widths first.
• Base CSS address mobile device first; media queries address for tablet, desktops.
• Progressive Enhancement
• Add elements as screen size increases.
[email protected] 17
Grid System
➢ The Bootstrap Grid System allows up to 12 columns across the page.
➢ You can use all 12 columns individually or you can groups the columns together to create wider
columns.
➢ Bootstrap Grid System is responsive and the columns are re-arranged automatically according to
the screen size.
[email protected] 18
Grid Classes
2. sm (for tablets)
3. md (for desktops)
➢You can combine the above classes to create more dynamic and flexible
layouts.
[email protected] 19
Media Queries in Grid System
➢ 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 the viewport size.
[email protected] 20
Basic Structure of Grid
[email protected] 21
Grid Example
[email protected] 22
Grid Options
Extra small devices Small devices Tablets Medium devices Large devices Desktops
Phones (<768px) (≥768px) Desktops (≥992px) (≥1200px)
Collapsed to start, Collapsed to start, Collapsed to start,
Grid behavior Horizontal at all times horizontal above horizontal above horizontal above
breakpoints breakpoints breakpoints
Max container width None (auto) 750px 970px 1170px
Class prefix .col-xs- .col-sm- .col-md- .col-lg-
# of columns 12 12 12 12
Max column width Auto 60px 78px 95px
[email protected] 24
Striped and Bordered Table