Lecture _Bootstrap_part1
Lecture _Bootstrap_part1
MM211
Responsive Web Design with
Zoubeir Aungnoo
Learning Outcomes
• Bootstrap definition
• Download & installation
• Grid System
Setup working environment
• Starting state of HTML provided to you in
Exercise folder – organised by chapter number
• Create a working folder called Bootstrap3
– Will contain Bootstrap’s CSS, JS and fonts + images
• Tools:
1. Text Editor: VS Code
– Setup Sublime Text to work with Bootstrap3
folder
• Project > Add Folder to Project
2. Web Browser: Any web browser you prefer
What is Bootstrap?
• Responsive design framework
– Easily & quickly build websites and web apps
• Can build static web sites and dynamic web
apps
– Use Bootstrap as it is out of the box or combine
with PHP or CMS to turn it more dynamic
• Controls the front end design of your site
– Without having to know a ton of HTML and CSS
What is Bootstrap?
• Used by a number of different organisations
• Portfolios:
1. Builtwithbootstrap.com
2. Lovebootstrap.com
3. expo.getbootstrap.com (official)
What’s new in Bootstrap 3?
• Mobile-first approach (from ground up)
– Some work has been done for you so that you do
not have to think about certain aspects of your
designs. E.g. The grid system
• Grid system
– 4 different sized grids: Extra Small, Small, Medium
and Extra Large
– Great way for laying out webpages
– Very customizable
What’s new in Bootstrap 3?
• CSS
– Flexible CSS
– Including LESS CSS: a CSS pre-processor system
that you can use to centralize your styles
• Customize Bootstrap the way you want
• Browser support
– Dropping support officially for IE7 and for Firefox
3.6
– will be supporting Internet Explorer 8 (minor
modifications needed) and higher.
Any disadvantages?
• Code Bloat
– But these extra lines of code increases flexibility to
address different situations
• Takes time to learn
Download & Install Bootstrap
1. Go to getbootstrap.com
2. Downloaded file bootstrap-3.3.5-dist.zip
contains 3 sub-folders: css, fonts & js
– The heart of Bootstrap. That's all you need.
3. Create a folder called Bootstrap3
4. Copy the css, fonts & js folders you
downoaded and paste them inside the
Bootstrap3 folder
Examining Bootstrap file structure
1. css folder: 4 stylesheets ship with Bootstrap
– *.css vs *.min.css
2. fonts folder: 4 fonts available – same fonts
but in different formats
– Support the glyphicon fonts available
– Series of icons that can be used in your website
design
3. js folder: bootstrap.js & bootstrap.min.js
– Note: also need to download jQuery &
respond.js
Adding CSS to a Bootstrap HTML file
A. Add meta tag
1. Copy Exercise>Chapter 1>01_04>index.html into
Bootstrap3 folder
2. Open Exercise>Chapter 1>01_04>additional.txt
and copy its content and paste into index.html
after <meta charset="utf-8">
Adding CSS to a Bootstrap HTML file
A. Add meta tag
• <meta name="viewport" content="width=device-
width, initial-scale=1.0">
– Purpose of this meta tag: to scale screens
correctly irrespective of small screens or large
ones.
B. Link to Bootstrap stylesheet
– Afer <title> tag, add a declaration to Bootstrap's
stylesheet:
• <link href="css/bootstrap.min.css" rel="stylesheet“>
Adding CSS to a Bootstrap HTML file
C. Link to custom stylesheet
– add another declaration to our custom stylesheet:
• <link href="css/custom.css" rel="stylesheet">
Note: It is important to put it after jQuery because it depends on jQuery. So, we need
the jQuery library to load first before Bootstrap loads.
Adding JS to a Bootstrap HTML file
C. Respond.js
– Helps older versions of IE understand HTML5
semantic markup and other various
incompatibilities with IE.
• Available @ https://getbootstrap.com/docs/5.1/getting-started/introduction/
Exploring Bootstrap’s Grid System
• 12 column grid system
• Mobile first
– Designed for you to think about small screen first
– Then think about larger desktop design
afterwards
• 4 sizes to this grid:
– http://getbootstrap.com/css/#grid
Exploring Bootstrap’s Grid System
• .
Exploring Bootstrap’s Grid System
• XS
– Designed for very small devices: phones
– <768 px
– Designed to be horizontal at all times
• SM, MD & LG
– Designed to be horizontal and at break points
they will stack.
– Breakpoints: >= 768 for SM, >= 922 for MD, >= 1200 for LG
– As grid goes narrower, SM, MD and LG grid will simply
stack vertically.
Exploring Bootstrap’s Grid System
• Copy grid.html from Exercise>Chapter
2>02_01 folder into Bootstrap3 folder.
• First row - 'master example grid‘: 3 cells:
coded using all 4 grid sizes
– Depending on screen resolution for the width, it's
going to display the name of the grid that's in use
inside each of the cells.
• Use of visibility classes
• Other rows: coded with one grid system alone
Which grid system to use?
• Can use all four of the grid systems together
in what you're doing
• Or can use just one/two/three depend on
your design and what you’re trying to achieve
• It really boils down to, how do things
look and how do you want them presented
on various devices
Creating new rows & cells
• Copy folder img & 02_02.html from
Exercise>Chapter 2>02_02 into Bootstrap3
• row 1 @ line 13
• row 2 - text + desc
• row 3 @ line 23 - 4 of these units of a picture, header,
text + read more link.
• row 4 @ line 41 – footer