Bootstrap
Bootstrap
Bootstrap
Tutorial 7
Sukwon Oh
soh@cs.toronto.edu
What is
Bootstrap?
▶ Bootstrap is the most popular framework for quickly styling your website.
▶ Bootstrap lets us skip writing CSS and focus instead on HTML.
What is Bootstrap?
CSS Components
▶ Grid system ▶ Glyphicons
▶ Typography ▶ Navbar
▶ Forms ▶ Pagination
▶ Buttons ▶ Thumbnails
▶ Responsive utilities ▶ ...
▶ ...
What is
Bootstrap?
Using
Bootstrap
Using
Bootstrap
Mobile
Friendly
▶ Bootstrap 3 is mobile friendly by default.
▶ Responsive to screen size (assignment 1)
▶ Touch screen zooming
▶ Example
.Container
▶ Example
margin margin
GridSystem
▶ Bootstrap divides a page into a grid of 12 columns and multiple rows for
easier positioning of elements.
▶ Grid system is responsive and columns will rearrange automatically depending
on the screen size.
GridSystem
GridSystem -
Basics
▶ Place columns inside <div class="row"></div> for each row.
▶ Set each column width using class prefixes:
▶ .col-xs-*, .col-sm-*, .col-md-*, .col-lg-*
Example
▶ Use col-xs-*, col-sm-*, col-md-* together to set different column widths for
different screen sizes
Example
On Desktop:
On Mobile:
GridSystem – Column
Resets
Sometimes at breakpoints, columns may be aligned in wrong places.
Go to next line
Responsive utilities
GridSystem -
Offsetting
▶ col-xs-offset-*
▶ col-sm-offset-*
▶ col-md-offset-*
▶ col-lg-offset-*
Example
GridSystem – Nested columns
▶ Examples
Resizing
Glyphicons
▶ Glyphicons are text!!!
▶ To resize glyphicons, simply increase its font size in CSS!
▶ Example
▶ Output
Forms
Right aligned
Navigation Bar
(.navbar)
▶ Creates a visible bar with navigation elements.
▶ Example
.navbar
Modifiers
and others …
There are still many more to
learn!
▶ Go over http://getbootstrap.com/getting-started/#examples
▶ Playground for bootstrap http://www.bootply.com/