Professional Documents
Culture Documents
CodeSchool BlastingOffWithBootstrap PDF
CodeSchool BlastingOffWithBootstrap PDF
Level 1, Section 1
So You Want To Build a Website
An attractive, functioning website requires basic knowledge of structure, style, and behavior.
Bootstrap
IHI
H
I
B HI
JA
B L
FJ AN
HINA C
C
C C
N J
L H I
What Will Bootstrap Do For Us?
Bootstrap lets us skip writing CSS and JavaScript when starting out. We focus instead on HTML.
Bootstrap
What Will Bootstrap Do For Us?
Bootstrap lets us skip writing CSS and JavaScript when starting out. We focus instead on HTML.
Bootstrap
QAA
J A
H B
HI J IJ
C
I C
A I
IHI
I
H B
JH JA
HINA C
C
A
I
What to Expect From Bootstrap
Lets take a look at some great examples of the magic that Bootstrap can make very quickly.
What to Expect From Bootstrap
Heres the goal for our end product at the end of this course.
How To Get A Hold of Bootstrap
There are three ways to get access to the framework, and well focus on one in particular.
http://go.codeschool.com/bootstrap-download
,
N J
A N
C L
. HH
HH
N J
C
I H
C
H I
I
What Does The Framework Consist Of?
Lets take a quick at Bootstraps le structure to get a broad awareness of what were using.
dist
What Does The Framework Consist Of?
Lets take a quick at Bootstraps le structure to get a broad awareness of what were using.
dist
css
fonts
js
What Does The Framework Consist Of?
Lets take a quick at Bootstraps le structure to get a broad awareness of what were using.
dist
css
bootstrap-theme.css H
H
I
B C
IHI HH
A
L QAA
bootstrap-theme.css.map JH
C
J
.
H
,I
L AA
H
JH
B
C C
I
L I
JC
bootstrap-theme.min.css
bootstrap.css
B C
A H
JH
L C
I
H I
bootstrap.css.map
H
A
JI
J
A B CI
bootstrap.min.css L QAA
JH
I
C C B C
C H
fonts
js
What Does The Framework Consist Of?
Lets take a quick at Bootstraps le structure to get a broad awareness of what were using.
dist
css
fonts
js
What Does The Framework Consist Of?
Lets take a quick at Bootstraps le structure to get a broad awareness of what were using.
dist
css
fonts
IHI
H
glyphicons-halings-regular.eot
CI
I I
C
glyphicons-halings-regular.svg JH
H
CH
glyphicons-halings-regular.ttf QAA
I
I
I H
glyphicons-halings-regular.wo IIN
H C
js
What Does The Framework Consist Of?
Lets take a quick at Bootstraps le structure to get a broad awareness of what were using.
dist
css
fonts
js
What Does The Framework Consist Of?
Lets take a quick at Bootstraps le structure to get a broad awareness of what were using.
dist
css
fonts
js
C
I
C L
JC
- I!
IHI
L AA
B
I
HN
C
JH
bootstrap.js
bootstrap.min.js
npm.js
What Does The Framework Consist Of?
Lets take a quick at Bootstraps le structure to get a broad awareness of what were using.
dist
css
fonts
js
Getting Started: Creating a Basic HTML File
To get up and running with Bootstrap, well need to establish our sites home page with some HTML.
<!DOCTYPE html>
<html lang='en'>
HI
L QAA
I
H IJ
L I
IN P
<head>
<title>Blasting Off With Bootstrap</title>
</head>
PI C
H
I
L I
I IA
</html> dist/index.html
Getting Started: Creating a Basic HTML File
To get up and running with Bootstrap, well need to establish our sites home page with some HTML.
<!DOCTYPE html>
<html lang='en'>
<head>
<title>Blasting Off With Bootstrap</title>
</head>
<body>
<h1>Blasting Off With Bootstrap</h1>
<h2>The Fastest Way to Space</h2>
<h3>Book Today!</h3>
MI
L QAA
B
N
C
<h3>Go Anywhere</h3>
H B
C I C A
CH
<h3>RocketBus®</h3>
</body>
</html> dist/index.html
Getting Started: Creating a Basic HTML File
To get up and running with Bootstrap, well need to establish our sites home page with some HTML.
<!DOCTYPE html>
<html lang='en'>
L
L QAA
H B
H
<head> I
H
J
CH
<title>Blasting Off With Bootstrap</title>
</head>
<body>
<h1>Blasting Off With Bootstrap</h1>
<h2>The Fastest Way to Space</h2>
<p>Make your way to space in the comfort of your own rocket, elevator or transporter.</p>
<h3>Book Today!</h3>
<p>Even if you're traveling tomorrow, you can still get tickets today. We have a
number of conveniently located ports around the globe to service everyone.</p>
<h3>Go Anywhere</h3>
<p>If you need to get to space today, why not try out a transporter? Despite the claims,
there are have been no deaths in the last 6 weeks!</p>
<h3>RocketBus®</h3>
<p>For cheapest fares, catch the next RocketBus to the stars. Cheaper on your wallet,
and easiest way to make friends.</p>
</body>
</html> dist/index.html
Getting Started: Creating a Basic HTML File
To get up and running with Bootstrap, well need to establish our sites home page with some HTML.
<!DOCTYPE html>
<html lang='en'>
<head>
<title>Blasting Off With Bootstrap</title>
</head>
<body>
<h1>Blasting Off With Bootstrap</h1>
<h2>The Fastest Way to Space</h2>
<p> </p>
<h3>Book Today!</h3>
<p>
</p>
<h3>Go Anywhere</h3>
<p>
</p>
<h3>RocketBus®</h3>
<p>
</p>
</body>
</html> dist/index.html
Getting Started: Creating a Basic HTML File
To get up and running with Bootstrap, well need to establish our sites home page with some HTML.
<!DOCTYPE html>
<html lang='en'>
<head>
<title>Blasting Off With Bootstrap</title>
</head>
<body>
<h1>Blasting Off With Bootstrap</h1>
<h2>The Fastest Way to Space</h2> <p> ... </p>
</body>
</html> dist/index.html
Getting Started: Creating a Basic HTML File
To get up and running with Bootstrap, well need to establish our sites home page with some HTML.
<!DOCTYPE html>
<html lang='en'>
<head>
<title>Blasting Off With Bootstrap</title>
</head>
<body>
<h1>Blasting Off With Bootstrap</h1>
<h2>The Fastest Way to Space</h2> <p> ... </p>
<button type='button'>Take the Tour</button>
<button type='button'>Book Tickets Now</button>
C H
J
CI CI
L QAA
J A
JII CH
JH
I
C
<h3>Book Today!</h3> <p> ... </p> L I
JC
J
C
IH
<h3>Go Anywhere</h3> <p> ... </p>
<h3>RocketBus®</h3> <p> ... </p>
</body>
</html> dist/index.html
Viewing Our Page Before Using Bootstrap
Heres a view of our basic HTML without any of the magic of Bootstrap.
Adding the Bootstrap Framework
To get Bootstrap acting on our content, well need to import a few extra items on our page.
<!DOCTYPE html>
<html lang='en'>
<head>
<title>Blasting Off With Bootstrap</title>
<link href='css/bootstrap.css' rel='stylesheet'>
</head>
<body>
QAA
HI
C
I
C AJ
...
I
IHI
A N
N
JH C
A I
I
</body>
</html> dist/index.html
Adding the Bootstrap Framework
To get Bootstrap acting on our content, well need to import a few extra items on our page.
<!DOCTYPE html>
<html lang='en'>
<head>
<title>Blasting Off With Bootstrap</title>
<link href='css/bootstrap.css' rel='stylesheet'>
</head>
<body> QAA
AH
C AJ
?2J N
... JH
IHI
C H
I
I
JC
A
I C H
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script>
</body>
</html> dist/index.html
Adding the Bootstrap Framework
To get Bootstrap acting on our content, well need to import a few extra items on our page.
<!DOCTYPE html>
<html lang='en'>
<head>
<title>Blasting Off With Bootstrap</title>
<link href='css/bootstrap.css' rel='stylesheet'>
</head>
<body>
I C AAN
QH
I
...
IHI
- I
A NP
L QAA
M A
I H
A I
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js'></script>
<script src='js/bootstrap.js'></script>
</body>
</html> dist/index.html
The Eects of Adding Bootstrap
Lets check out what Bootstrap will do to our existing HTML page.
QH
J
C I A
M HI C
The Eects of Adding Bootstrap
Lets check out what Bootstrap will do to our existing HTML page.
?JHI
CI
C
C
H B
CIAN
HINA
JII CH
QH
HI AA
JC
L
C
!
Our Visual Goal For This Level
Well be using classes to improve our HTML visually, but without writing a single line of CSS.
QAA
I
J
CI CI
CI
IL C
H
B CH
JH C
IHI QH
.container A HH
The container Class
Bootstraps container class will responsively add margins, center, and wrap our content.
index.html
<body>
QH
AA
J
H A
<h1>Blasting Off With Bootstrap</h1>
<h2>The Fastest Way to Space</h2> CI CI
L I C
J
N
I
<button type='button'>Take the Tour</button>
<button type='button'>Book Tickets Now</button>
<h3>Book Today!</h3> <p>...</p>
<h3>Go Anywhere</h3> <p>...</p>
<h3>RocketBus®</h3> <p>...</p>
</body>
The container Class
Bootstraps container class will responsively add margins, center, and wrap our content.
index.html
<body>
C
.container A HH
I H
M
<div class='container'>
<h1>Blasting Off With Bootstrap</h1> L I
A B CI
I I
H C H
I
I
<h2>The Fastest Way to Space</h2> J CI
H
I
LH
L C L
<button type='button'>Take the Tour</button>
<button type='button'>Book Tickets Now</button>
<h3>Book Today!</h3> <p>...</p>
<h3>Go Anywhere</h3> <p>...</p>
<h3>RocketBus®</h3> <p>...</p>
</div>
</body>
The container Class
Bootstraps container class will responsively add margins, center, and wrap our content.
H
L AA
I
J
I
CI
L I
HB I
C
L
C
I A I
C !
The container Class
Bootstraps container class will responsively add margins, center, and wrap our content.
The container-fluid Class
Bootstraps container-fluid class allows for stretching if it is desired on larger screens.
index.html
<body>
<div class='container'>
<h1>Blasting Off With Bootstrap</h1>
<h2>The Fastest Way to Space</h2>
<button type='button'>Take the Tour</button>
<button type='button'>Book Tickets Now</button>
<h3>Book Today!</h3> <p>...</p>
<h3>Go Anywhere</h3> <p>...</p>
<h3>RocketBus®</h3> <p>...</p>
</div>
</body>
The container-fluid Class
Bootstraps container-fluid class allows for stretching if it is desired on larger screens.
index.html
<body>
<div class='container'>
<h1>Blasting Off With Bootstrap</h1>
<h2>The Fastest Way to Space</h2>
<button type='button'>Take the Tour</button>
<button type='button'>Book Tickets Now</button>
</div>
<div class='container-fluid'>
<h3>Book Today!</h3> <p>...</p> L
J
IJ H
L AA
I
CI C
I I
<h3>Go Anywhere</h3> <p>...</p> L AA
HI I
I
CI
IIN
HINA H
<h3>RocketBus®</h3> <p>...</p>
</div>
C
JH JA
C
CAN
C
A HH!
</body>
The container-fluid Class
Bootstraps container-fluid class allows for stretching if it is desired on larger screens.
Lift O
Level 1, Section 1
Thinking In Grids
Level 2, Section 1
Our Site Wrapped in a .container
So far weve learned how a .container class helps structure our content.
8
FO
F
T
OF H
5
A
I
C
OE
L 0
Site Structure: Rows
Rows are horizontal groupings of data
8
FO
E
,
C
A O
Site Structure: Columns
Columns are vertical groupings of data
8
FO
E
LO H
H I
F EO
Multiple Columns
Bootstrap gives us 12 columns to work with if we need them
HH
I
H I
U
F
HH
Our Header in a Grid
Elements can span all columns in our grid FOH
L
H I
Taking Up Half the Page
With 12 columns, you can use 6 to take up half the page
A
6I
? OE
L
-
H I
Getting Even Smaller
You probably wont ever need 12 individual columns, but 4 is common enough
4 O
E
L
H I
Wire framing our Grid Design
Wire framing is a great way to visualize and plan out our page.
12 Columns 2 H I
AA
L
O
L
6 Columns 6 Columns
class='col-md-12'
class='col-md-6' class='col-md-6'
2 H I
OFHH
AA
L
O
index.html
<div class='container'>
<h1>Blasting Off With Bootstrap</h1>
index.html
<div class='container'>
<div class='col-md-12'>
<h1>Blasting Off With Bootstrap</h1>
</div>
... 8
E A
O
L
HH
H I
</div>
Lead Grid Using 6 Columns
Determine the number of columns you want, then pick the correct Bootstrap class for it.
index.html
<div class='container'>
<div class='col-md-12'>...</div> 8 O
E
H A
O SO
A
? OO
FHH
O
L
-
H I
<h2>The Fastest Way to Space</h2>
<p>Make your way to space...</p>
<button type='button'>Take the Tour</button>
<button type='button'>Book Tickets Now</button>
<img src='images/blast.png' alt='Blasting Off' />
...
</div> 8
FI
FHH
O
L
OE
-
H I
Lead Grid Using .col-md-6
Use a class of .col-md-6 to contain an element to 6 columns, or half the page.
index.html
<div class='container'>
<div class='col-md-12'>...</div>
<div class='col-md-6'>
<h2>The Fastest Way to Space</h2>
<p>Make your way to space...</p> ...
E
H I
</div> LL
FA
?T
FA
<div class='col-md-6'>
<img src='images/blast.png' alt='Blasting Off' />
</div>
</div>
Feature Grid Using 4 Columns
Using one-third of the page, or 4 columns. 4 columns * 3 elements = 12 columns total.
index.html
OU
I
E
C O
<div class='container'>... O
L
H I
<h3>Book Today!</h3>
<p>Even if you're traveling</p>
<h3>Go Anywhere</h3>
<p>If you need to get to space today...</p>
<h3>RocketBus®</h3>
<p>For cheapest fares, catch the</p>
</div>
Feature Grid Using .col-md-4
The next featured item will be immediately to the right.
index.html 3 E
C O
FHH
O
L
H I
<div class='container'>...
<div class='col-md-4'>
<h3>Book Today!</h3> <p>Even if you're traveling</p>
</div>
<div class='col-md-4'>
<h3>Go Anywhere</h3> <p>If you need to get to space today</p>
</div>
<div class='col-md-4'>
<h3>RocketBus®</h3> <p>For cheapest fares, catch the</p>
</div>
</div>
Column Preview
Our page is starting to take shape!
Grid Refactoring
Its dicult to know when a new row starts without doing math.
index.html
<div class='container'>
<div class='row'>
<div class='col-md-12'></div>
F
I
A
</div>
H O
F
O
A
<div class='row'>
<div class='col-md-6'></div>
<div class='col-md-6'></div>
</div>
<div class='row'>
<div class='col-md-4'></div>
<div class='col-md-4'></div>
<div class='col-md-4'></div>
</div>
</div>
Row Preview
Our page looks almost the same, but its actually using 15px more of the screen with rows
*
C
O O
Adding too Many Columns
What should happen if you include more than 12 columns in a row?
index.html
E O
HA
OEF
H
<div class='container'> HF
F
? 0
<div class='row'>
<div class='col-md-4'></div>
<div class='col-md-5'></div>
<div class='col-md-4'></div>
</div>
</div>
Multiple Rows
Our last featured item doesnt have enough space and moves onto its own row
9 I
OEF
OE O
E LL A
? C
O O A
F
.row
Designing With Grids
A popular proportion for sites with grids is 9 columns + 3 columns
/&*
F
A
C
12 Columns ?H
FOE
FA ?
9 Columns 3 Columns
Letting Columns Breathe with Blanks
Adding a bit of space between columns can help them appear less cluttered
12 Columns
5
HA
O
H I
C
L AAF 0
8 Columns 1 3 Columns
Empty Columns
Dont create empty columns. Bootstrap has a better way!
index.html
<div class='container'>
<div class='row'>
<div class='col-md-12'></div>
2 HA
O
</div> ILOT
H I
? O
<div class='row'> OE
F
? OO
T
<div class='col-md-8'></div>
<div class='col-md-1'></div>
<div class='col-md-3'></div>
</div>
</section>
Empty Columns Using an Oset
The .col-md-offset-* class is used to add left padding for a given number of columns.
index.html
1AA
H I
C
L AAF
O
OE
H CO
C
OE
FA ?
Blog Example
An example blog from the Bootstrap website using this technique
.
H I
C
O O
H I
CC O
*
H I
C
OE
FA ?
Thinking In Grids
Level 2, Section 1
Responsive Gridding
Level 2, Section 2
Our Website So Far
It looks great on our desktops screen, but if we view it on a phone, our columns are gone!
I
B
OL
? OHI
L
E
B L
?L I
R
Our Goal Mobile Layout
0E
E
EH
EI
H L
L ONE I
8 E
E? I
H I
UL
EI
N
H
NS EI
I
I
ON
F
8 S
I
EN
I
L
Medium Screen Size
A good starting point for your design. Looks good on laptops and desktops.
<div class='row'>
<div class='col-md-4'>
<h3>Book Today!</h3>...
</div>
. ?
B NOL
O
I
<div class='col-md-4'>
<h3>Go Anywhere</h3>...
EBB L IN
L
I
H L
?L I
</div>
<div class='col-md-4'>
<h3>RocketBus®</h3>...
</div>
</div>
Adding Grids for Smaller Resolutions
Our featured items will have the same grid sizes in small and medium mode.
index.html
8
E
LF
EI
<div class='row'> R
I
E L
<div class='col-sm-4'>
<h3>Book Today!</h3>...
</div>
<div class='col-sm-4'>
<h3>Go Anywhere</h3>...
</div>
<div class='col-sm-4'>
<h3>RocketBus®</h3>...
</div>
</div>
Feature Columns in Medium Sized Screens
E EI
N
EI
VH EOHW
H
NOL
L
NE
IIEI
? OHI
?
Feature Columns in Small Sized Screens
E EI
N E
I
N N
4OL
B NOL
?
I
? OHI
EI
V H W
H
I
P
Extra Small Mode
N
ON
R,
0 L U
OL
I
PE
?
V RNL
H W
H
UP
N
OL
? OHI
EI!
2 NU
F
EIN
N
O
EN
H L
?
Extra Small Browser Sizes
Great for specifying the minimum width for elements. Also the layout used on many phones.
<div class='row'>
<div class='col-xs-4'> 2 F
EN
<h3>Book Today!</h3>...
?L H
? I
</div>
<div class='col-xs-4'>
NN L!
<h3>Go Anywhere</h3>...
</div>
<div class='col-xs-4'>
<h3>RocketBus®</h3>...
</div>
</div>
Reviving our Goal Layout
We can plan out how many columns each of our elements will use prior to jumping into the code.
V F
8 SW
E
O
? OHI
4OL
N L
B NOL
E
?
O
? OHI
1NU
P
I
BB N
I
N
BN
I
LE N
Features in Extra Small Screens
index.html
V F
8 SW
E
N F
O
? OHI
<div class='row'>
<div class='col-sm-4 col-xs-12'>
<h3>Book Today!</h3>
</div>
<div class='col-sm-4 col-xs-6'>
<h3>Go Anywhere</h3>
8
N L
N
</div>
<div class='col-sm-4 col-xs-6'>
B NOL
E
N F
O
<h3>RocketBus®</h3> ? OHI
I
</div> V F
8 SW
</div>
Extra Small Feature Layout
Using our new extra small classes, our features section is taking shape.
N
N E
F
EF
I
I
NE
I
N
I
BB N
N
V F
8 SW
Centering Features for Extra Small Screens
This will center this column giving it a column of spacing on each side
9
N
HE
? OHI
<div class='row'>
<div class='col-sm-4 col-xs-10 col-xs-offset-1'>
<h3>Book Today!</h3>
</div>
<div class='col-sm-4 col-xs-6'> 8
L L
B
<h3>Go Anywhere</h3> N
?
</div> IUN
H NN L
<div class='col-sm-4 col-xs-6'>
<h3>RocketBus®</h3>
</div>
</div>
Book Today On Extra Small Screens
Go Anywhere started on a new row because it needed 6 columns and only 1 was available.
V F
8 SW
N I
ON
I
RNL
H
?L I
Overriding Osets for Small Screens
4OL
.col-xs-offset-1
E
EI
E
N
V H W
I
VH EOHW
L ONE I
7EI?
UL
O EI
? OHI
EI
N
BEL N
LET IN
?
N
N
P LB EI
H IN
E
H P
N
N
I RN
L
Removing the Oset for Small Screens
index.html
<div class='row'>
<div class='col-sm-4 col-xs-10 col-xs-offset-1
col-sm-offset-0'>
<h3>Book Today!</h3>
</div>
<div class='col-md-3 col-sm-4 col-xs-6'> 6 H P
N
BB N
<h3>Go Anywhere</h3> EI
V H W
H
</div> I
P
<div class=col-md-3 col-sm-4 col-xs-6'>
<h3>RocketBus®</h3>
</div>
</div>
Removing Osets
This will center this column giving it a column of spacing on each side
BB N
B L
N
BEL N
B NOL
R? N
EI
RNL
H
H
Very Large Screens
Great for monitors with a lot of space. Not used as often as other grid sizes.
O
I S
N E
EH
B L
VH EOHW
I
V L W
L ONE I
Hiding Elements using .hidden-*
We can hide elements in specic screen sizes
0E
N E
H IN
B L
H
index.html I
RNL
H
L ONE I
<div class='row'>
<div class='col-md-6'>...</div>
<div class='col-md-6 hidden-sm hidden-xs'>
<img src='images/blast.png' alt='Blasting Off' />
</div>
</div>
.hidden-xs .hidden-md
O
? I
E
H IN
EI
.hidden-sm .hidden-lg N L
?L I
ET
N
Hiding Elements using .hidden-*
8
EH
E
E I
B L
H
I
RNL
H
L ONE I
Making Elements Visible using .visible-*
We can specify a screen size for elements to be visible
4I S
N E
H IN
EI
index.html H EOH
I
L
L ONE I
<div class='row'>
<div class='col-md-6'>...</div>
<div class='col-md-6 visible-md visible-lg'>
<img src='images/blast.png' alt='Blasting Off' />
</div>
</div>
.visible-xs .visible-md
O
? I
?EBS
N L
.visible-sm .visible-lg ?L I
ET
N
Making Elements Visible using .visible-*
8
H IN
E
PE E
EI
VH EOHW
I
V L W
L ONE I
ON
I N EI
Typography
Level 3
What is Typography?
The art and technique of arranging type to make written language most appealing - Wikipedia
D
B
L
bootstrap.css
B
H
B
body {
font-family: "Helvetica Neue",
Helvetica, Arial, sans-serif;
font-size: 14px; ?
L
line-height: 1.42857143; B
color: #333;
background-color: #fff;
}
Manual Typography for the Lead
Using Bootstraps manual typography to improve your page
B
A ?
H
B
H
A
Using the .lead Typography Class
2
D
index.html H
B
H
<div class='row'>
<div class='col-md-6'>
<h2>The Fastest Way to Space</h2>
<p class='lead'>Make your way to space...</p>
</div> ...
</div>
.lead
AD B
A B
B
A
AD
Comparing Our Lead
Use .lead to make text stand out from the rest of the page.
No .lead
.
H
B
H
B
H !
Using .lead
Centering Text
Bootstrap has a number of alignment classes for text.
N
B
H
H
A
Using the .text-* Typography Classes
index.html
B
B
<div class='row text-center'>
<div class='...'>
<h3>Book Today!</h3>
<p>Even if you're traveling tomorrow...</p>
</div>
...
</div>
B
B
B
H
B
H
H
D
Glyphicons
Bootstrap comes with 200 icons to use, named glyphicons.
dist 0 A A
2 L
css B B
B!
fonts
glyphicons-halings-regular.eot
glyphicons-halings-regular.svg
glyphicons-halings-regular.ttf
glyphicons-halings-regular.wo
js
http://go.codeschool.com/bootstrap-glyphicons
Using Glyphicons
Icon classes should only be used on elements that contain no text content and have no child elements.
index.html