1 of 18

Responsive Design

2 of 18

One website - many devices

How do we make the same website look good on a phone, tablet, laptop, and big desktop?

3 of 18

4 of 18

Design

Not just 1 design anymore.

Many, many iterations.

Easy to get confused.

5 of 18

Breakpoints/Media Queries

Explicitly say where the content/CSS will change

Media queries can get complex

6 of 18

Media Query examples

@media (min-width: 320px) { ... }

@media (min-width: 320px) and (orientation: landscape) { ... }

@media (max-width: 960px) { ... }

JSBin example

7 of 18

tl;dr

Responsive design is HARD and CONFUSING on your own.

Enter CSS Frameworks...Bootstrap is the most popular.

8 of 18

Installing Bootstrap - #1

Download all the files and host locally

  • kinda complicated
  • slow since user must download all the files (vs a CDN)
  • helps when learning Bootstrap; see all the actual code

9 of 18

Installing Bootstrap - #2

Use a CDN

  • Easier
  • Better performance if user has downloaded before
  • Make sure to add jQuery CDN too!

10 of 18

Installing Bootstrap - #2

<script src="https://code.jquery.com/jquery.min.js"></script>

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" type="text/css" />

<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>

11 of 18

Installing Bootstrap - #3

Meteor makes it easy.

  • Search for the top option on Atmosphere
  • Install the Atmosphere package
  • One line and you’re done!

12 of 18

Containers

13 of 18

Grid System

12 point system.

col-xs-*

col-sm-*

col-md-*

col-lg-*

14 of 18

Grid System example

https://csci16.hellometeor.com/bootstrap-in-action.html

Create new folder “bootstrap-in-action” and “index.html” file.

Download HTML & change around columns.

Play around with col-xs, col-sm, col-md, col-lg options. (Remember, grid of 12!)

15 of 18

Bootstrap Nav Bars

Try removing “navbar-right” from your code. What happens?

http://getbootstrap.com/components/#navbar

Play around with other navbar options Bootstrap gives us.

Another example: https://getbootstrap.com/examples/navbar/

16 of 18

In a Meteor App

Remember: use Atmosphere package to install.

Do NOT need to inline add bootstrap code for css & js

17 of 18

Responsive Design Tip

Think VERTICAL for small screens.

Think HORIZONTAL for larger screens.

18 of 18

What next?

Might want to link dropdowns to new pages. Use routes.