Lift O
Lift O
!
!
Level 1, Section 1
Lift O
Lift O
!
!
Level 1, Section 1
So You Want To Build a Website…
So You Want To Build a Website…
An attractive, functioning website requires basic knowledge of structure, style, and behavior.
An attractive, functioning website requires basic knowledge of structure, style, and behavior.
HTML
HTML
CSS
CSS
JavaScript
JavaScript
Page Structure
Page Structure
Element Styling
Element Styling
Page Behavior
Page Behavior
Website Development Follows Some Typical Patterns
Writing HTML, CSS, and JavaScript repeatedly will reveal just how much work a good website can require.
CSS
Writing HTML, CSS, and JavaScript repeatedly will reveal just how much work a good website can require.
CSS
HTML JavaScript
Writing HTML, CSS, and JavaScript repeatedly will reveal just how much work a good website can require.
CSS
HTML JavaScript
Writing HTML, CSS, and JavaScript repeatedly will reveal just how much work a good website can require.
CSS
HTML JavaScript
Writing HTML, CSS, and JavaScript repeatedly will reveal just how much work a good website can require.
CSS
HTML JavaScript
CSS
HTML JavaScript
IHI H I BHI JA
BL FJAN HINAC
Frameworks Can Make Our Site-Building Life Much Easier
A framework is a downloadable library of tools that assist with adding style and functionality to your website.
CSS
HTML JavaScript
What Will Bootstrap Do For Us?
Bootstrap lets us skip writing CSS and JavaScript when starting out. We focus instead on HTML.
Bootstrap.css HTML
What Will Bootstrap Do For Us?
Bootstrap lets us skip writing CSS and JavaScript when starting out. We focus instead on HTML.
Bootstrap
Bootstrap.js
What to Expect From Bootstrap
What to Expect From Bootstrap
There are three ways to get access to the framework, and we’ll focus on one in particular.
http://go.codeschool.com/bootstrap-download
How To Get A Hold of Bootstrap
What Does The Framework Consist Of?
Let’s take a quick at Bootstrap’s!le structure to get a broad awareness of what we’re using.
What Does The Framework Consist Of?
Let’s take a quick at Bootstrap’s!le structure to get a broad awareness of what we’re using.
dist
css
fonts
js
What Does The Framework Consist Of?
Let’s take a quick at Bootstrap’s!le structure to get a broad awareness of what we’re using.
BC AH JH LC I HI
H A JI J ABCI
LQAA JH I CCBC CH
dist
css
fonts
js
bootstrap-theme.css
bootstrap-theme.css.map
bootstrap-theme.min.css
bootstrap.css
bootstrap.css.map
bootstrap.min.css
H H I BC IHIHH A LQAA
JH C J . H ,I LAA H JH
B CC I LI JC
What Does The Framework Consist Of?
Let’s take a quick at Bootstrap’s!le structure to get a broad awareness of what we’re using.
dist
css
fonts
js
What Does The Framework Consist Of?
Let’s take a quick at Bootstrap’s!le structure to get a broad awareness of what we’re using.
IHI H
CI II C
JH H CH
QAA I I IH
IIN HC
dist
css
fonts
js
glyphicons-hal
"ings-regular.eot
glyphicons-hal
"ings-regular.svg
glyphicons-hal
"ings-regular.ttf
glyphicons-hal
"ings-regular.wo
#What Does The Framework Consist Of?
Let’s take a quick at Bootstrap’s!le structure to get a broad awareness of what we’re using.
dist
css
fonts
js
What Does The
What Does The
Frame
Frame
work Consist Of?
work Consist Of?
Let’s take a quick at
Let’s take a quick at Bootstrap’Bootstrap’ss!!le structure to get a broad awareness of what le structure to get a broad awareness of what we’rwe’re using.e using.
dist
dist
css
css
fonts
fonts
js
js
bootstrap.js
bootstrap.js
bootstrap.min.js
bootstrap.min.js
npm.js
npm.js
C I CL JC -I!
C I CL JC -I!
IHI
What Does The
What Does The
Frame
Frame
work Consist Of?
work Consist Of?
Let’s take a quick at
Let’s take a quick at Bootstrap’Bootstrap’ss!!le structure to get a broad awareness of what le structure to get a broad awareness of what we’rwe’re using.e using.
dist
dist
css
css
fonts
fonts
js
js
Getting Started: Creating a Basic HTML File
Getting Started: Creating a Basic HTML File
To get up and running with Bootstrap, we’ll need to establish our site’s home page with some HTML.
To get up and running with Bootstrap, we’ll need to establish our site’s home page with some HTML.
<head>
<head>
<
<titletitle>>Blasting Off With BootstrapBlasting Off With Bootstrap</</titletitle>>
<!DOCTYPE html>
<!DOCTYPE html>
<html
<html lang=lang='en''en'>>
</head>
</head>
HI LQAA I HIJ LI IN
HI LQAA I HIJ LI IN
P
P
P
Getting Started: Creating a Basic HTML File
To get up and running with Bootstrap, we’ll need to establish our site’s home page with some HTML.
<!DOCTYPE html> <html lang='en'>
<head>
<title>Blasting Off With Bootstrap </title> </head>
<body>
MI LQAA B N C
HB CICA CH
<h1>Blasting Off With Bootstrap</h1><h2>The Fastest Way to Space</h2>
<h3>Book Today!</h3>
<h3>Go Anywhere</h3>
<h3>RocketBus®</h3>
Getting Started: Creating a Basic HTML File
To get up and running with Bootstrap, we’ll need to establish our site’s 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>
<h3>Go Anywhere</h3>
<h3>RocketBus®</h3>
</body>
<p>Make your way to space in the comfort of your own rocket, elevator or transporter. </p>
<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>
<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>
<p>For cheapest fares, catch the next RocketBus® to the stars. Cheaper on your wallet, and easiest way to make friends. </p>
L LQAA HB H
I H J CH
Getting Started: Creating a Basic HTML File
To get up and running with Bootstrap, we’ll need to establish our site’s 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> <h3>Go Anywhere</h3> <h3>RocketBus®</h3> </body> <p> </p> <p> </p> <p> </p> <p> </p>
Getting Started: Creating a Basic HTML File
To get up and running with Bootstrap, we’ll need to establish our site’s 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> <h3>Go Anywhere</h3> <h3>RocketBus®</h3> </body> <p> </p> <p> </p> <p> </p> <p> </p> ... ... ... ...
Getting Started: Creating a Basic HTML File
To get up and running with Bootstrap, we’ll need to establish our site’s 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> <h3>Go Anywhere</h3> <h3>RocketBus®</h3> </body> <p> </p> <p> </p> <p> </p> <p> </p> ... ... ... ...
CH J CICI LQAA
JA JIICH JH I C
LI JC J C IH
<button type='button'>Take the Tour</button>Viewing Our Page Before Using Bootstrap
Adding the Bootstrap Framework
To get Bootstrap acting on our content, we’ll need to import a few extra items on our page.
<!DOCTYPE html> <html lang='en'>
<head>
<title>Blasting Off With Bootstrap </title>
</head> <body>
</body> </html>
...
<link href='css/bootstrap.css' rel='stylesheet'>
QAA HI C I CAJ
I IHI AN N
JHC AI I
Adding the Bootstrap Framework
To get Bootstrap acting on our content, we’ll need to import a few extra items on our page.
<!DOCTYPE html> <html lang='en'>
<head>
<title>Blasting Off With Bootstrap </title>
</head> <body>
</body> </html>
...
<link href='css/bootstrap.css' rel='stylesheet'>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js' ></script>
QAA AH CAJ ?2JN
JH IHI CH I I
JC A ICH
Adding the Bootstrap Framework
To get Bootstrap acting on our content, we’ll need to import a few extra items on our page.
<!DOCTYPE html> <html lang='en'>
<head>
<title>Blasting Off With Bootstrap </title>
</head> <body>
</body> </html>
...
<link href='css/bootstrap.css' rel='stylesheet'>
<script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js' ></script> <script src='js/bootstrap.js' ></script>
ICAAN QH I
IHI -I ANP
LQAA MA IH AI
Let’s check out what Bootstrap will do to our existing HTML page.
The E
!
ects of Adding Bootstrap
QH J CIA
MHIC
Let’s check out what Bootstrap will do to our existing HTML page.
The E
!
ects of Adding Bootstrap
?JHI CI C C
HB CIAN HINA JIICH
QH HIAA JC L C !
Our Visual Goal For This Level
We’ll be using classes to improve our HTML visually, but without writing a single line of CSS.
QAA I J CICI CI ILC H BCH JHC IHIQH .container AHH
Bootstrap’s container class will responsively add margins, center, and wrap our content.
<body>
</body>
The
container
Class
QH AA J HA
CICI LIC J N I
<h1>Blasting Off With Bootstrap</h1><h2>The Fastest Way to Space</h2>
<h3>Book Today!</h3> <p>...</p> <h3>Go Anywhere</h3> <p>...</p> <h3>RocketBus®</h3> <p>...</p>
<button type='button'>Take the Tour</button> <button type='button'>Book Tickets Now</button>
Bootstrap’s container class will responsively add margins, center, and wrap our content.
<body>
</body>
The
container
Class
<h1>Blasting Off With Bootstrap</h1> <h2>The Fastest Way to Space</h2>
<h3>Book Today!</h3> <p>...</p> <h3>Go Anywhere</h3> <p>...</p> <h3>RocketBus®</h3> <p>...</p>
<button type='button'>Take the Tour</button> <button type='button'>Book Tickets Now</button> <div class='container'>
</div>
C
.containerAHH IH M
LI ABCI II HCH I I
JCI H I LH LCL
The
container
Class
Bootstrap’s container class will responsively add margins, center, and wrap our content.
H LAA I J
I CI
LI HBI
C
L C
IAI C!
The
container
Class
The
The
container-fluid
container-fluid
Class
Class
Bootstrap’s
Bootstrap’s container-fluidcontainer-fluid class allows for stretching if it is class allows for stretching if it is desired on larger screens.desired on larger screens.
<body>
<body>
</body>
</body>
<h1>
<h1>Blasting Off With BootstrapBlasting Off With Bootstrap</h1></h1>
<h2>
<h2>The Fastest Way to SpaceThe Fastest Way to Space</h2></h2>
<h3>
<h3>Book Today!Book Today!</h3> <p></h3> <p>...</p></p>
<h3>
<h3>Go AnywhereGo Anywhere</h3> <p></h3> <p>...</p></p>
<h3>
<h3>RocketBus®RocketBus®</h3> <p></h3> <p>...</p></p>
<
<button typebutton type=='button''button'>>Take the TourTake the Tour</</buttonbutton>>
<
<button typebutton type=='button''button'>>Book Tickets NowBook Tickets Now</</buttonbutton>>
<div
<div class=class='container''container'>>
</div>
</div>
index.html
The
The
container-fluid
container-fluid
Class
Class
Bootstrap’s
Bootstrap’s container-fluidcontainer-fluid class allows for stretching if it is class allows for stretching if it is desired on larger screens.desired on larger screens.
index.html index.html <body> <body> </body> </body> <h1>
<h1>Blasting Off With BootstrapBlasting Off With Bootstrap</h1></h1>
<h2>
<h2>The Fastest Way to SpaceThe Fastest Way to Space</h2></h2>
<h3>
<h3>Book Today!Book Today!</h3> <p></h3> <p>...</p></p>
<h3>
<h3>Go AnywhereGo Anywhere</h3> <p></h3> <p>...</p></p>
<h3>
<h3>RocketBus®RocketBus®</h3> <p></h3> <p>...</p></p>
<
<button typebutton type=='button''button'>>Take the TourTake the Tour</</buttonbutton>>
<
<button typebutton type=='button''button'>>Book Tickets NowBook Tickets Now</</buttonbutton>>
<div
<div class=class='container''container'>>
</div>
</div>
<div
<div class=class='container-fluid''container-fluid'>>
</div>
</div>
L J IJH LAA I CIC II
L J IJH LAA I CIC II
LAA HII I CI IIN HINAH
LAA HII I CI IIN HINAH
C JHJA C CAN C AHH!
The
The
container-fluid
container-fluid
Class
Class
Bootstrap’s
Lift O
!
Thinking In Grids
Our Site Wrapped in a
.container
8 FO F T
OFH 5 A
I C
OE L0
Rows are horizontal groupings of data
Site Structure: Rows
8 FO E , C AO
Columns are vertical groupings of data
Site Structure: Columns
8 FO E
LOH
HI FEO
Bootstrap gives us 12 columns to work with if we need them
Multiple Columns
HH I
HI
U F
HH
Elements can span all columns in our grid
Our Header in a Grid
With 12 columns, you can use 6 to take up half the page
Taking Up Half the Page
A 6I
?OE L
You probably won’t ever need 12 individual columns, but 4 is common enough
Getting Even Smaller
4O E L HI
Wire framing is a great way to visualize and plan out our page.
Wire framing our Grid Design
2HI AA L O L 6 Columns 6 Columns 12 Columns 4 Columns 4 Columns 4 Columns
Bootstrap uses .col-md-* classes for denoting the number of columns
Bootstrap Medium Screen Grid Design
2HI OFHH AA L O class='col-md-6' class='col-md-6' class='col-md-12' class='col-md-4' class='col-md-4' class='col-md-4'
index.html
Adding Grids to Our HTML
Here’s part of our content from level one that we’ll convert to grids
<div class='container'>
<h1>Blasting Off With Bootstrap</h1>
<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' /> ...
index.html
Using 12 Columns for our Title
8 EA O L HH HI
Use a class of .col-md-12 to wrap areas of your page you want to take up the entire width.
<div class='container'>
<h1>Blasting Off With Bootstrap</h1>
... </div>
<div class='col-md-12'>
index.html
Lead Grid Using 6 Columns
8O E HA OSO A ?OO
FHH O L - HI
8 FI FHH O L OE - HI
Determine the number of columns you want, then pick the correct Bootstrap class for it.<div class='container'>
<div class='col-md-12'> </div>
<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>
index.html
Lead Grid Using
.col-md-6
E HI
LL FA ?T FA
Use a class of .col-md-6 to contain an element to 6 columns, or half the page.<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> </div>
<div class='col-md-6'>
<img src='images/blast.png' alt='Blasting Off' /> </div>
</div>
index.html
Feature Grid Using 4 Columns
OU I E CO O L HI
Using one-third of the page, or 4 columns. 4 columns * 3 elements = 12 columns total.
<div class='container'>... <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>
index.html
Feature Grid Using
.col-md-4
3E CO FHH O L HI The next featured item will be immediately to the right.
<div class='container'>...
<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> </div> <div <div <div class='col-md-4'> class='col-md-4'> class='col-md-4'> </div> </div>
Our page is starting to take shape!
index.html
Grid Refactoring
<div class='container'> <div class='col-md-12'>...</div> <div class='col-md-6'>...</div> <div class='col-md-6'>...</div> <div class='col-md-4'>...</div> <div class='col-md-4'>...</div> <div class='col-md-4'>...</div> </div>U LF ?T HI ?O
EO ?O ?T 0
Adding Rows using
.row
F I A
HO F O A
The number of columns in each row adds up to 12.
<div <div <div </div> </div> </div> class='row'> class='row'> class='row'> <div class='container'> <div class='col-md-12'></div> <div class='col-md-6'></div> <div class='col-md-6'></div> <div class='col-md-4'></div> <div class='col-md-4'></div> <div class='col-md-4'></div>
Our page looks almost the same, but it’s actually using 15px more of the screen with rows
Our page looks almost the same, but it’s actually using 15px more of the screen with rows
Row Preview
Row Preview
* C * C OO OOindex.html
index.html
Adding too Many Columns
Adding too Many Columns
EO HA OEF H
EO HA OEF H
HF F ?0
HF F ?0
<div
<div class=class='container''container'>>
<div
<div class=class='row''row'>>
<div
<div class=class='col-md-4''col-md-4'></div>></div>
<div
<div class=class='col-md-5''col-md-5'></div>></div>
<div
<div class=class='col-md-4''col-md-4'></div>></div>
</div>
</div>
</div>
</div>
What should happen if you include more than 12 columns in a row?
Our last featured item doesn’t have enough space and moves onto its own row
Our last featured item doesn’t have enough space and moves onto its own row
Multiple Rows
Multiple Rows
9I OEF OEO ELLA
9I OEF OEO ELLA
?C OOA F
A popular proportion for sites with grids is 9 columns + 3 columns
Designing With Grids
/&* F A C
?H FOE
FA?
9 Columns 3 Columns
Adding a bit of space between columns can help them appear less cluttered
Letting Columns Breathe with Blanks
5 HA
O HI
C LAAF0
8 Columns 12 Columns 3 Columns 1index.html
Empty Columns
2HA O
ILOT HI ?O
OE F ?OO T
<div class='container'> <div class='row'> <div class='col-md-12'></div> </div> <div class='row'> <div class='col-md-8'></div> <div class='col-md-1'></div> <div class='col-md-3'></div> </div> </section>index.html
Empty Columns Using an O
!
set
1AA HI C LAAF O OE HCO C OE FA?
col-md-offset-*
EF HA
?
<div class='container'> <div class='row'> <div class='col-md-12'></div> </div> <div class='row'> <div class='col-md-8'></div><div class='col-md-3 '></div> </div>
</section>
The .col-md-offset-* class is used to add left padding for a given number of columns.
An example blog from the Bootstrap website using this technique
Blog Example
. HI C OO
* HI C OE FA? HI CCO
Thinking In Grids
Responsive Gridding
Our Website So Far
I B OL ?OHI L
Our Goal Mobile Layout
0E E EH EI
HL LONEI
ON F 8S
I EN I L
8E E?I HI
UL EI N
H NSEI
I I
Medium Screen Size
Grid Class .col-md-* O! set Class .col-md-offset-* Screen Size 992px+ Grid Size MediumDesigning for Smaller Screens
Grid Class .col-md-* O! set Class .col-md-offset-* Screen Size 992px+ .col-sm-* .col-sm-offset-* 768px+ Grid Size Medium Smallindex.html
Our Current Features
.? BNOL O I
EBBLIN L I HL ?LI
<div class='row'> <div class='col-md-4'> <h3>Book Today!</h3>... </div> <div class='col-md-4'> <h3>Go Anywhere</h3>... </div> <div class='col-md-4'> <h3>RocketBus®</h3>... </div> </div>
index.html
Adding Grids for Smaller Resolutions
8 E LF EI
R I EL
<div class='row'> <div class=' '> <h3>Book Today!</h3>... </div> <div class=' '> <h3>Go Anywhere</h3>... </div> <div class=' '> <h3>RocketBus®</h3>... </div> </div>Our featured items will have the same grid sizes in small and medium mode.
col-sm-4
col-sm-4
Feature Columns in Medium Sized Screens
NOL L NE IIEI ?OHI ?
EEI N
EI VHEOHW H
Feature Columns in Small Sized Screens
Feature Columns in Small Sized Screens
4OL BNOL ? I
4OL BNOL ? I
?OHI EI VHW
?OHI EI VHW
H I P
H I P
EEI NE
EEI NE
I NN
I NN
Extra Small Mode
Extra Small Mode
N ON R,
N ON R,
0LU OL I PE
0LU OL I PE
? VRNL HW H
? VRNL HW H
UP N OL ?OHI EI!
UP N OL ?OHI EI!
2NU F EIN N O
2NU F EIN N O
EN HL ?
Extra Small Browser Sizes
Extra Small Browser Sizes
Grid Class
Grid Class
.col-md-*
.col-md-*
O
O! ! set Classset Class
.col-md-offset-* .col-md-offset-* Screen Size Screen Size 992px+ 992px+ . .ccooll--ssmm--* * ..ccooll--ssmm--ooffffsseett--** 768px+768px+ . .ccooll--xxss--* * ..ccooll--xxss--ooffffsseett--** 0px+0px+ Grid Size Grid Size Medium Medium Small Small Extra Small Extra Small
Great for specifying the minimum width for elements. Also the layout used on many phones.
index.html
Adding Grids for Extra Small Screens
<div class='row'> <div class='col-xs-4'> <h3>Book Today!</h3>... </div> <div class='col-xs-4'> <h3>Go Anywhere</h3>... </div> <div class='col-xs-4'> <h3>RocketBus®</h3>... </div> </div>
We could use the extra small grids, but there’s a better way.
2F EN
?LH ?I NNL!
Reviving our Goal Layout
VF 8SW E
O ?OHI
4OL NL
BNOL E ?
O ?OHI
1NU P I BBN I
N BN I LEN
index.html
Features in Extra Small Screens
VF 8SW E NF O ?OHI
8 NL N
BNOL E NF O
?OHI I
VF 8SW
<div class='row'> <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> col-xs-12 col-xs-6 col-xs-6Extra Small Feature Layout
N NE F
EF I I
NE I N I
BBN N VF 8SW
Centering Features for Extra Small Screens
9 N HE ?OHI 8 LL B N ? IUN HNNL <div class='row'> <div class='col-sm-4 '> <h3>Book Today!</h3> </div><div class='col-sm-4 col-xs-6'> <h3>Go Anywhere</h3>
</div>
<div class='col-sm-4 col-xs-6'> <h3>RocketBus®</h3>
</div> </div>
This will center this column giving it a column of spacing on each side
“Book Today” On Extra Small Screens
VF 8SW NI ON
I RNL H ?LI
Overriding O
!
sets for Small Screens
4OL
.col-xs-offset-1E EI
E N VHW I VHEOHW
LONEI
7EI? UL OEI ?OHI EI N BELN
LETIN ? N N PLBEI
HIN E HP N N IRN L
index.html
Removing the O
!
set for Small Screens
<div class='row'>
<div class='col-sm-4 col-xs-10 col-xs-offset-1 '>
<h3>Book Today!</h3> </div>
<div class='col-md-3 col-sm-4 col-xs-6'> <h3>Go Anywhere</h3>
</div>
<div class=‘col-md-3 col-sm-4 col-xs-6'> <h3>RocketBus®</h3> </div> </div> 6HP N BBN EI VHW H I P col-sm-offset-0
Removing O
!
sets
BBN BL N BELN BNOL R?N EI RNL H H
Very Large Screens
Grid Class .col-md-* O! set Class .col-md-offset-* Screen Size 992px+ .col-sm-* .col-sm-offset-* 768px+ .col-xs-* .col-xs-offset-* 0px+ .col-lg-* .col-lg-offset-* 1200px+ Grid Size Medium Small Extra Small LargeHiding Columns
O IS
NE EH
BL VHEOHW I
VLW LONEI
index.html
Hiding Elements using
.hidden-*
0E NE HIN BL H I RNL H LONEI We can hide elements in speci!c screen sizes
.hidden-xs
.hidden-sm
.hidden-md
.hidden-lg
O ?I E HIN EI NL ?LI ET N
<div class='row'>
<div class='col-md-6'>...</div>
<div class='col-md-6 '>
<img src='images/blast.png' alt='Blasting Off' /> </div>
</div>
Hiding Elements using
.hidden-*
8 EH E EI BL H
I RNL H LONEI
index.html
Making Elements Visible using
.visible-*
4IS NE HIN EI
HEOH I L LONEI
We can specify a screen size for elements to be visible.visible-xs
.visible-sm
.visible-md
.visible-lg
O ?I ?EBS NL
?LI ET N
<div class='row'>
<div class='col-md-6'>...</div>
<div class='col-md-6 '>
<img src='images/blast.png' alt='Blasting Off' /> </div>
</div>
Making Elements Visible using
.visible-*
8 HIN E PEE EI VHEOHW I
VLW LONEI ON INEI
Typography
“The art and technique of arranging type to make written language most appealing” - Wikipedia
What is Typography?
bootstrap.css
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 14px; line-height: 1.42857143; color: #333; background-color: #fff; }
D B L
B H B
? L
B
Using Bootstraps manual typography to improve your page
Manual Typography for the Lead
B A? H B H A
index.html
Using the
.lead
Typography Class
2 D
H B H
.lead ADB AB
B A AD
<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> ...
Comparing Our Lead
No.lead
Using .lead
. H B
H B H!
N B H H A
Bootstrap has a number of alignment classes for text.
index.html
Using the
.text-*
Typography Classes
B
B
.text-center .text-right .text-left .text-nowrap .text-justifyD A
B BAB
<div class='row text-center'> <div class='...'>
<h3>Book Today!</h3>
<p>Even if you're traveling tomorrow...</p> </div>
... </div>
Centering Our Features
B B B H B H H DBootstrap comes with 200 icons to use, named “glyphicons”.
Glyphicons
0AA 2L
BB B!
dist
css
fonts
js
glyphicons-hal
!ings-regular.eot
glyphicons-hal
!ings-regular.svg
glyphicons-hal
!ings-regular.ttf
glyphicons-hal
!ings-regular.wo
"http://go.codeschool.com/bootstrap-glyphicons
index.html
Using Glyphicons
,B HB B
<img>
N H B
<i>
H B
Icon classes should only be used on elements that contain no text content and have no child elements.
<div class='...'>
<i class='glyphicon'></i> <h3>Book Today!</h3>
<p>Even if you're traveling...</p> </div>
L B
.glyphicon BN BLB N
B DL B H
index.html
Adding an Icon
2 .glyphicon D H H DI B B
Pick out an icon to use. In this case we’ll use the briefcase icon.
<div class='...'>
<i class='glyphicon '></i> <h3>Book Today!</h3>
<p>Even if you're traveling...</p> </div>
2 .glyphicon-briefcase D B H H
index.html
Adding Icons for Other Features
<div class='...'>
<i class='glyphicon '></i> <h3>Book Today!</h3>
</div>
<div class='...'>
<i class='glyphicon glyphicon-random'></i> <h3>Go Anywhere</h3>
</div>
<div class='...'>
<i class='glyphicon glyphicon-send'></i> <h3>RocketBus®</h3>
</div>
Our Icons Look a Little Small
body { font-size: 14px; ... }L H B
? A
0AA D
H
font-size B
HAD HD B
bootstrap.cssindex.html
Adding a Stylesheet
<!DOCTYPE html> <html lang='en'>
<head>
<link href='css/bootstrap.css' rel='stylesheet'> <link href='css/main.css' rel='stylesheet'>
</head> <body> ... </body> </html>
N H L B
main.cssL
index.html
Increasing the Icon Font Size
B
L B
HB
.features css/main.css .features .glyphicon { font-size: 32px; } B HB
.features
<div class='row features'><div class='...'>
<i class='glyphicon glyphicon-briefcase'></i> <h3 class='text-center'>Book Today!</h3>
</div> ... </div>
Larger Icons
H B B D!
B B B
H A A L
Changing the Icon Color
css/main.css B L B
H L !
N B ?D H B
? H ?B!
.features .glyphicon { font-size: 32px; color: red; }Cleaning up our Footer
N H AIB
HL H
N
B
index.html
<div class='...'> <h4>Links</h4>
Our Footer Code So Far
N B?
B B
list-style
<ul> <ul> <li><a href='index.html'>Home</a></li> <li><a href='tickets.html'>Tickets</a></li> <li><a href='stations.html'>Stations</a></li> </ul> </div>index.html
Unstyled Lists
3 D AI H .list-unstyled .list-inline 3 ,BB B <div class='...'> <h4>Links</h4> class='list-unstyled'> <ul <div class='...'> <h4>Links</h4> <li><a href='index.html'>Home</a></li> <li><a href='tickets.html'>Tickets</a></li> <li><a href='stations.html'>Stations</a></li> </ul> </div>Our Finished Footer
H ?
? B!
Typography
Enough CSS to be Dangerous
Adding a Dash of Style
?? . . ? . ? . B B . ? . ? ..? B ? ? ?. ? index.html
Another Look at Our Lead
<div class='row'>
<div class='col-md-6'>
<h2>The Fastest Way to Space</h2>
<p class='lead'>Make your way to space...</p> <button type='button'>Take the Tour</button> <button type='button'>Book Tickets Now</button> </div> ...
</div>
index.html
That Went
.well
.well
A . ? ?
<div class='row '> <div class='col-md-6'>
<h2>The Fastest Way to Space</h2>
<p class='lead'>Make your way to space...</p> <button type='button'>Take the Tour</button> <button type='button'>Book Tickets Now</button> </div> ...
</div>
Use the.well class to give the element a gray background and a rounded gray border.
index.html
Adding More Spacing
. ? ? B
.well-lg .well-sm
A .
B . .? .
<div class='row '> <div class='col-md-6'>
<h2>The Fastest Way to Space</h2>
<p class='lead'>Make your way to space...</p> <button type='button'>Take the Tour</button> <button type='button'>Book Tickets Now</button> </div>
</div>
well-lg
<div class='col-md-6'>...</div> well
Well Preview
.
. ? ?
? ? ?
?? C?!
index.html
Styling Our Buttons
<button type='button'>Take the Tour</button> <button type='button'>Book Tickets Now</button>
?? ? ? ??
. ??. . ? ?B. ? ?
Our buttons look di! erent in every browser. Let’s use Bootstrap to standardize them.<button type='button' <button type='button'
class='btn </button> class='btn </button>
'>Take the Tour '>Book Tickets Now
Making Our Buttons Larger
,. ?
.glyphicon B
.btn. ? ?? .
.btn-lg .btn-sm .btn-xs ? !
We can change the size of buttons by adding another class.
btn-lg btn-lg <button type='button' <button type='button' class='btn class='btn ... ... '> '> </button> </button>
index.html
Changing Button Color
. . ? .? ?. ?!
We can change the background and text color of buttons by adding another class.
btn-default
btn-primary <button type='button' class='btn btn-lg '>
Take the Tour </button>
<button type='button' class='btn btn-lg '> Book Tickets Now
index.html
Many Many Colors
?? A .!
.btn-success .btn-primary
.btn-default
.btn-info .btn-danger .btn-warning
<button type='button' class='btn btn-lg btn-default'> </button> btn-primary
<button type='button' class='btn btn-lg '> </button> ...
Buttons and Wells
Enough CSS to be Dangerous
Navigating Navigation
We Need Navigation!
? ?!
A
C
A
Our Goal Navigation
.?
? A
We’ll be building out our navigation to include a few links an a link to the homepage.
C ?
C ?
index.html
Expanding Our Header
<div class='container'> <div class='row'>
<div class='col-md-12'>
<h1>Blasting Off With Bootstrap</h1> </div>
</div> </div>
A C C
index.html
Removing Grids
C ? A
<div class='container'> <div class='row'> <div class='col-md-12'><h1>Blasting Off With Bootstrap</h1> </div>
</div> </div>
index.html
Adding Links
A A A ?A!
<div class='container'><h1>Blasting Off With Bootstrap</h1>
</div>
We’ll start our navigation with some of the links that are already in our footer.
<ul>
<li><a href='tickets.html'>Tickets</a></li> <li><a href='stations.html'>Stations</a></li> <li><a href='about.html'>About</a></li>
Not So Styled Nav
A
H
<h1>index.html
Converting Our
H1
<div class='container'> <h1>
Blasting Off With Bootstrap </h1>
<ul>...</ul> </div>
A AC C
?
h1index.html
Using
.navbar-brand
<div class='container'>
Blasting Off With Bootstrap
<ul>...</ul> </div>
C F
C A
The .navbar-brand class will !oat the text left, increase the font size and more.
<a href='/' class='navbar-brand'>
index.html
Using
.nav
<div class='container'>
<a href='/' class='navbar-brand'> Blasting Off With Bootstrap
</a>
<ul >...</ul> </div>
A ?
A
.nav
A
.glyphicon
.btnI A CA
AAA
.nav
Modi
!
ers
C A
<ul class='nav '>...</ul>
<ul class='nav nav-tabs'>...</ul>
<ul class='nav navbar-nav navbar-right'>…</ul>
The .nav class with modi!ers can be used for a main navigation, or a subnav on your page.
Our Navigation In Progress
.navbar-navA
A C
A
C A A ?
C C
Our Goal Nav
A C
AA AA A
index.html
Using
.navbar
A A
A ?
.navbar-inverse .navbar-default <div class='container '><a href='/' class='navbar-brand'>Blasting Off With Bootstrap</a>
<ul class='nav navbar-nav navbar-right'>...</ul> </div>
CA
.navbar-default C A
Navbar in a container
A
C A
A
AA
A
A A A C
Setting a Background for our Navigation
index.html
<div class='container navbar navbar-default'> ...
</div>
.navbar-default
A
C
AA ?
<div class='navbar navbar-default'> <div class='container'>
... </div> </div>
Positioning our Navigation
index.html .navbar-static-top .navbar-static-bottom .navbar-fixed-top .navbar-fixed-bottom<div class='navbar navbar-default '>...</div>
F A A
, A
?
The.navbar has some modi!cations available that allow "exibility in navbar position and visibility.
Our Finished Navigation
An Alternate Navigation
.nav
.navbar
What’s the di! erence between these two?
Navigating Navigation
JavaScript Components
Navigation in Extra Small Mode
I JHCB CC?G
M B LH
G CO
.M GCI J H
CG BM GC H
B GCCB BHG H
Expandable Navigation
CSS is for styling the page, JavaScript is for adding behavior to the page.
CSS vs JavaScript Refresher
CSS JavaScriptStyle
Behavior
CCG CBHG
CGHCBB B
B H
? LB ?MGG
index.html
Our Existing Navigation
.nav BH G H
Here’s the navigation we’ve build so far. It has a .navbar with a .container inside of it.
<div class='navbar navbar-default navbar-static-top'> <div class='container'>
<a href='/' class='navbar-brand'>...</a>
<ul class='nav navbar-nav navbar-right ...</ul> </div>
</div>
index.html
Collapsing Our Navigation
I BJHCB G B B GB GNG!
C C CBM H CBM B LH G C
Adding the.collapse class will hide an element in all resolutions thanks to the collapse plugin.
collapse <ul class='nav navbar-nav navbar-right '>
... </ul>
index.html
Showing Our Navigation For Larger Screens
I BJHCB GCG I C G GBG B
CJ IH G B B LH G C
The .navbar-collapse class will only hide the nav in extra small mode.
navbar-collapse collapse
<ul class='nav navbar-nav navbar-right '> ...
index.html
Toggling Navigation
G G CI IHHCB
We’ll add a button that will make our navigation links visible only when the user desires it.
navbar-collapse collapse
<ul class='nav navbar-nav navbar-right '>
<div class='navbar navbar-default navbar-static-top'> <div class='container'>
<a href='index.html' class='navbar-brand'>...</a>
<button type='button'>Toggle navigation</button>
</div> </div>